We have a .net application with a javascript client. When I set the server timeout to 9000 or higher, the AfterSubscribe event is being hit all the time (with just one client connected). If the timeout is lower than this then the event is only fired when the client first connects.
Does anyone know what could be causing this please?
- Which version are you using?
- What does your server-side configuration look like (web.config or
programmatically)?
- What does your client-side connect/subscribe code look like?
> We have a .net application with a javascript client. When I set the
> server timeout to 9000 or higher, the AfterSubscribe event is being hit all
> the time (with just one client connected).
> If the timeout is lower than this then the event is only fired when the
> client first connects.
> Does anyone know what could be causing this please?
> Many thanks,
> Simon.
> --
> You received this message because you are subscribed to the Google Groups
> "WebSync" group.
> To post to this group, send email to websync@googlegroups.com.
> To unsubscribe from this group, send email to
> websync+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/websync/-/QuF5IBjpHbYJ.
> For more options, visit https://groups.google.com/groups/opt_out.
-We're using v 3.5.0.13 -Server side uses web.config -connect code is as follows (not sure if this will help):
[WebSyncEvent(EventType.AfterSubscribe)] public static void AfterSubscribe(object sender, WebSyncEventArgs e) { if (e.Source != EventSource.Client) { return; }
foreach (var message in e.Messages) {
if (string.IsNullOrEmpty(message.MetaJson)) continue;
var authRequest = JSON.Deserialize<AuthenticationRequest>(message.MetaJson);
var returnData = GetInitialData(authRequest); var serializer = new JavaScriptSerializer(); var jsonMsg = new StringBuilder(); var readRepository = new ReadRepository();
var responseData = new { auctionState = readRepository.GetLastestAuctionStateByAuctionGuid(authRequest.AuctionGuid) , latestInformation = returnData }; serializer.Serialize( new {eventType = MessageTypeEnum.InitialiseApp.ToString(), data = responseData}, jsonMsg); message.DataJson = jsonMsg.ToString(); }
} On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
> Simon,
> - Which version are you using? > - What does your server-side configuration look like (web.config or > programmatically)? > - What does your client-side connect/subscribe code look like?
> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <si.grif...@gmail.com<javascript:> > > wrote:
>> Hi there,
>> We have a .net application with a javascript client. When I set the >> server timeout to 9000 or higher, the AfterSubscribe event is being hit all >> the time (with just one client connected). >> If the timeout is lower than this then the event is only fired when the >> client first connects.
>> Does anyone know what could be causing this please?
>> Many thanks,
>> Simon.
>> -- >> You received this message because you are subscribed to the Google Groups >> "WebSync" group. >> To post to this group, send email to web...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> websync+u...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/websync/-/QuF5IBjpHbYJ. >> For more options, visit https://groups.google.com/groups/opt_out.
- What does your server config look like (copy/paste your settings from
web.config)?
- On the client-side, what does your connect/subscribe code look like
(where you actually create the client)?
> if (string.IsNullOrEmpty(message.MetaJson)) continue;
> var authRequest =
> JSON.Deserialize<AuthenticationRequest>(message.MetaJson);
> var returnData = GetInitialData(authRequest);
> var serializer = new JavaScriptSerializer();
> var jsonMsg = new StringBuilder();
> var readRepository = new ReadRepository();
> var responseData = new
> {
> auctionState =
> readRepository.GetLastestAuctionStateByAuctionGuid(authRequest.AuctionGuid) ,
> latestInformation = returnData
> };
> serializer.Serialize(
> new {eventType = MessageTypeEnum.InitialiseApp.ToString(),
> data = responseData}, jsonMsg);
> message.DataJson = jsonMsg.ToString();
> }
> }
> On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
>> Simon,
>> - Which version are you using?
>> - What does your server-side configuration look like (web.config or
>> programmatically)?
>> - What does your client-side connect/subscribe code look like?
>> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <si.grif...@gmail.com>wrote:
>>> Hi there,
>>> We have a .net application with a javascript client. When I set the
>>> server timeout to 9000 or higher, the AfterSubscribe event is being hit all
>>> the time (with just one client connected).
>>> If the timeout is lower than this then the event is only fired when the
>>> client first connects.
>>> Does anyone know what could be causing this please?
>>> Many thanks,
>>> Simon.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "WebSync" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to websync+u...@**
>>> googlegroups.com.
>> --
> You received this message because you are subscribed to the Google Groups
> "WebSync" group.
> To post to this group, send email to websync@googlegroups.com.
> To unsubscribe from this group, send email to
> websync+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/websync/-/_IKrsfcSNO0J.
Gap.live.communication.connect = function (connectArgs) { connectArgs = $.extend(new Gap.live.communication.ConnectArgs(), connectArgs);
// no parameters are necessary unless you want to override default behaviours comms.client.initialize({ timeout: 2000, retries: 0, stream: { timeout: 9000 } });
var connectionError = false; comms.client.connect({ meta: connectArgs.meta, stayConnected: true, onSuccess: function (result) { connected = true; if (connectionError) { connectionError = false; if (typeof (Operator) == "undefined") { //Gap.live.communication.showNotification("Connection is restored!"); } } log('connected'); if (connectArgs.onSuccess) { connectArgs.onSuccess(result); } }, onFailure: function (result) { log('connect failed'); if (connectArgs.onFailure) { connectArgs.onFailure(result); } }, onStreamFailure: function (args) { connectionError = true; if (typeof (Operator) == "undefined") { //Gap.live.communication.showNotification("Connection is dropped"); } log('stream failed'); }, onUnhandledReceive: function (result) { messageReceived(result, connectArgs.onUnhandledReceive); } }); };
If I comment out the line: stream: { timeout: 9000 } The reported behaviour stops (I have no idea why these settings are in place, i've inherited this code)
On Friday, November 16, 2012 3:51:56 PM UTC, Anton Venema wrote:
> Hi Simon,
> Sorry, let me clarify:
> - What does your server config look like (copy/paste your settings from > web.config)? > - On the client-side, what does your connect/subscribe code look like > (where you actually create the client)?
>> if (string.IsNullOrEmpty(message.MetaJson)) continue;
>> var authRequest = >> JSON.Deserialize<AuthenticationRequest>(message.MetaJson);
>> var returnData = GetInitialData(authRequest); >> var serializer = new JavaScriptSerializer(); >> var jsonMsg = new StringBuilder(); >> var readRepository = new ReadRepository();
>> var responseData = new >> { >> auctionState = >> readRepository.GetLastestAuctionStateByAuctionGuid(authRequest.AuctionGuid) , >> latestInformation = returnData >> }; >> serializer.Serialize( >> new {eventType = MessageTypeEnum.InitialiseApp.ToString(), >> data = responseData}, jsonMsg); >> message.DataJson = jsonMsg.ToString(); >> } >> }
>> On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
>>> Simon,
>>> - Which version are you using? >>> - What does your server-side configuration look like (web.config or >>> programmatically)? >>> - What does your client-side connect/subscribe code look like?
>>> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <si.grif...@gmail.com>wrote:
>>>> Hi there,
>>>> We have a .net application with a javascript client. When I set the >>>> server timeout to 9000 or higher, the AfterSubscribe event is being hit all >>>> the time (with just one client connected). >>>> If the timeout is lower than this then the event is only fired when the >>>> client first connects.
>>>> Does anyone know what could be causing this please?
>>>> Many thanks,
>>>> Simon.
>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "WebSync" group. >>>> To post to this group, send email to web...@googlegroups.com. >>>> To unsubscribe from this group, send email to websync+u...@** >>>> googlegroups.com.
>>> -- >> You received this message because you are subscribed to the Google Groups >> "WebSync" group. >> To post to this group, send email to web...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> websync+u...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/websync/-/_IKrsfcSNO0J.
Try changing the stream timeout on the *client* side to 11000. You don't
want the streaming connection to timeout (and abort) after 9 seconds when
the server is only set up to respond every 9 seconds (if there are no
messages to deliver). You need a bit of buffer room for network latency and
server timing.
Note that this manual calculation is only necessary in WebSync 3. In
WebSync 4, the stream timeout property is gone in favour of an automatic
calculation using this equation.
> // no parameters are necessary unless you want to override default behaviours
> comms.client.initialize({
> timeout: 2000,
> retries: 0,
> stream: { timeout: 9000 }
> });
> var connectionError = false;
> comms.client.connect({
> meta: connectArgs.meta,
> stayConnected: true,
> onSuccess: function (result) {
> connected = true;
> if (connectionError) {
> connectionError = false;
> if (typeof (Operator) == "undefined") {
> //Gap.live.communication.showNotification("Connection is restored!");
> }
> }
> log('connected');
> if (connectArgs.onSuccess) {
> connectArgs.onSuccess(result);
> }
> },
> onFailure: function (result) {
> log('connect failed');
> if (connectArgs.onFailure) {
> connectArgs.onFailure(result);
> }
> },
> onStreamFailure: function (args) {
> connectionError = true;
> if (typeof (Operator) == "undefined") {
> //Gap.live.communication.showNotification("Connection is dropped");
> }
> log('stream failed');
> },
> onUnhandledReceive: function (result) {
> messageReceived(result, connectArgs.onUnhandledReceive);
> }
> });
> };
> If I comment out the line: stream: { timeout: 9000 }
> The reported behaviour stops (I have no idea why these settings are in
> place, i've inherited this code)
> Thanks,
> Simon.
> On Friday, November 16, 2012 3:51:56 PM UTC, Anton Venema wrote:
>> Hi Simon,
>> Sorry, let me clarify:
>> - What does your server config look like (copy/paste your settings from
>> web.config)?
>> - On the client-side, what does your connect/subscribe code look like
>> (where you actually create the client)?
>>> if (string.IsNullOrEmpty(message.**MetaJson)) continue;
>>> var authRequest = JSON.Deserialize<**AuthenticationRequest>(**
>>> message.MetaJson);
>>> var returnData = GetInitialData(authRequest);
>>> var serializer = new JavaScriptSerializer();
>>> var jsonMsg = new StringBuilder();
>>> var readRepository = new ReadRepository();
>>> var responseData = new
>>> {
>>> auctionState = readRepository.**
>>> GetLastestAuctionStateByAuctio**nGuid(authRequest.AuctionGuid)**,
>>> latestInformation = returnData
>>> };
>>> serializer.Serialize(
>>> new {eventType = MessageTypeEnum.InitialiseApp.**ToString(),
>>> data = responseData}, jsonMsg);
>>> message.DataJson = jsonMsg.ToString();
>>> }
>>> }
>>> On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
>>>> Simon,
>>>> - Which version are you using?
>>>> - What does your server-side configuration look like (web.config or
>>>> programmatically)?
>>>> - What does your client-side connect/subscribe code look like?
>>>> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <si.grif...@gmail.com>wrote:
>>>>> Hi there,
>>>>> We have a .net application with a javascript client. When I set the
>>>>> server timeout to 9000 or higher, the AfterSubscribe event is being hit all
>>>>> the time (with just one client connected).
>>>>> If the timeout is lower than this then the event is only fired when
>>>>> the client first connects.
>>>>> Does anyone know what could be causing this please?
>>>>> Many thanks,
>>>>> Simon.
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "WebSync" group.
>>>>> To post to this group, send email to web...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to websync+u...@**
>>>>> googlegroups.com.
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "WebSync" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to websync+u...@**
>>> googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/websync/-/_IKrsfcSNO0J<https://groups.google.com/d/msg/websync/-/_IKrsfcSNO0J>
>>> .
>> --
> You received this message because you are subscribed to the Google Groups
> "WebSync" group.
> To post to this group, send email to websync@googlegroups.com.
> To unsubscribe from this group, send email to
> websync+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/websync/-/EW5vODiIH8cJ.
One final question. Would it be better to have the client timeout slightly longer than the server timeout? Otherwise wouldn't the client think the request has timed out before it actually has?
On Monday, November 19, 2012 5:05:33 PM UTC, Anton Venema wrote:
> Hi Simon,
> Try changing the stream timeout on the *client* side to 11000. You don't > want the streaming connection to timeout (and abort) after 9 seconds when > the server is only set up to respond every 9 seconds (if there are no > messages to deliver). You need a bit of buffer room for network latency and > server timing.
> Note that this manual calculation is only necessary in WebSync 3. In > WebSync 4, the stream timeout property is gone in favour of an automatic > calculation using this equation.
>> // no parameters are necessary unless you want to override default behaviours >> comms.client.initialize({ >> timeout: 2000, >> retries: 0, >> stream: { timeout: 9000 } >> });
>> var connectionError = false; >> comms.client.connect({ >> meta: connectArgs.meta, >> stayConnected: true, >> onSuccess: function (result) { >> connected = true; >> if (connectionError) { >> connectionError = false; >> if (typeof (Operator) == "undefined") { >> //Gap.live.communication.showNotification("Connection is restored!"); >> } >> } >> log('connected'); >> if (connectArgs.onSuccess) { >> connectArgs.onSuccess(result); >> } >> }, >> onFailure: function (result) { >> log('connect failed'); >> if (connectArgs.onFailure) { >> connectArgs.onFailure(result); >> } >> }, >> onStreamFailure: function (args) { >> connectionError = true; >> if (typeof (Operator) == "undefined") { >> //Gap.live.communication.showNotification("Connection is dropped"); >> } >> log('stream failed'); >> }, >> onUnhandledReceive: function (result) { >> messageReceived(result, connectArgs.onUnhandledReceive); >> } >> }); >> };
>> If I comment out the line: stream: { timeout: 9000 } >> The reported behaviour stops (I have no idea why these settings are in >> place, i've inherited this code)
>> Thanks,
>> Simon.
>> On Friday, November 16, 2012 3:51:56 PM UTC, Anton Venema wrote:
>>> Hi Simon,
>>> Sorry, let me clarify:
>>> - What does your server config look like (copy/paste your settings from >>> web.config)? >>> - On the client-side, what does your connect/subscribe code look like >>> (where you actually create the client)?
>>>> if (string.IsNullOrEmpty(message.**MetaJson)) continue;
>>>> var authRequest = JSON.Deserialize<**AuthenticationRequest>(** >>>> message.MetaJson);
>>>> var returnData = GetInitialData(authRequest); >>>> var serializer = new JavaScriptSerializer(); >>>> var jsonMsg = new StringBuilder(); >>>> var readRepository = new ReadRepository();
>>>> var responseData = new >>>> { >>>> auctionState = readRepository.** >>>> GetLastestAuctionStateByAuctio**nGuid(authRequest.AuctionGuid)**, >>>> latestInformation = returnData >>>> }; >>>> serializer.Serialize( >>>> new {eventType = MessageTypeEnum.InitialiseApp.**ToString(), >>>> data = responseData}, jsonMsg); >>>> message.DataJson = jsonMsg.ToString(); >>>> } >>>> }
>>>> On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
>>>>> Simon,
>>>>> - Which version are you using? >>>>> - What does your server-side configuration look like (web.config or >>>>> programmatically)? >>>>> - What does your client-side connect/subscribe code look like?
>>>>> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <si.grif...@gmail.com >>>>> > wrote:
>>>>>> Hi there,
>>>>>> We have a .net application with a javascript client. When I set the >>>>>> server timeout to 9000 or higher, the AfterSubscribe event is being hit all >>>>>> the time (with just one client connected). >>>>>> If the timeout is lower than this then the event is only fired when >>>>>> the client first connects.
>>>>>> Does anyone know what could be causing this please?
>>>>>> Many thanks,
>>>>>> Simon.
>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "WebSync" group. >>>>>> To post to this group, send email to web...@googlegroups.com. >>>>>> To unsubscribe from this group, send email to websync+u...@** >>>>>> googlegroups.com.
>>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "WebSync" group. >>>> To post to this group, send email to web...@googlegroups.com. >>>> To unsubscribe from this group, send email to websync+u...@** >>>> googlegroups.com. >>>> To view this discussion on the web visit https://groups.google.com/d/** >>>> msg/websync/-/_IKrsfcSNO0J<https://groups.google.com/d/msg/websync/-/_IKrsfcSNO0J> >>>> .
>>> -- >> You received this message because you are subscribed to the Google Groups >> "WebSync" group. >> To post to this group, send email to web...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> websync+u...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/websync/-/EW5vODiIH8cJ.
That's exactly what the client-side "stream timeout" is for, and why it
should be 11000 when the server timeout is 9000. It is used for the
asynchronous, streaming requests.
The server-side "timeout" comes from the Bayeux spec (an unfortunate naming
coincidence). It applies to the streaming connections only, and defaults to
25 seconds. It's the amount of time the server spends waiting for data to
send back to a client before checking to make sure the client is still
present.
> One final question. Would it be better to have the client timeout
> slightly longer than the server timeout? Otherwise wouldn't the client
> think the request has timed out before it actually has?
> Thanks,
> Simon.
> On Monday, November 19, 2012 5:05:33 PM UTC, Anton Venema wrote:
>> Hi Simon,
>> Try changing the stream timeout on the *client* side to 11000. You don't
>> want the streaming connection to timeout (and abort) after 9 seconds when
>> the server is only set up to respond every 9 seconds (if there are no
>> messages to deliver). You need a bit of buffer room for network latency and
>> server timing.
>> Note that this manual calculation is only necessary in WebSync 3. In
>> WebSync 4, the stream timeout property is gone in favour of an automatic
>> calculation using this equation.
>>> If I comment out the line: stream: { timeout: 9000 **}
>>> The reported behaviour stops (I have no idea why these settings are in
>>> place, i've inherited this code)
>>> Thanks,
>>> Simon.
>>> On Friday, November 16, 2012 3:51:56 PM UTC, Anton Venema wrote:
>>>> Hi Simon,
>>>> Sorry, let me clarify:
>>>> - What does your server config look like (copy/paste your settings from
>>>> web.config)?
>>>> - On the client-side, what does your connect/subscribe code look like
>>>> (where you actually create the client)?
>>>>> if (string.IsNullOrEmpty(message.****MetaJson)) continue;
>>>>> var authRequest = JSON.Deserialize<**Authenticatio**nRequest>(
>>>>> **message.MetaJson);
>>>>> var returnData = GetInitialData(authRequest);
>>>>> var serializer = new JavaScriptSerializer();
>>>>> var jsonMsg = new StringBuilder();
>>>>> var readRepository = new ReadRepository();
>>>>> var responseData = new
>>>>> {
>>>>> auctionState = readRepository.**
>>>>> GetLastestAucti**onStateByAuctio**nGuid(**authRequest.AuctionGuid)**,
>>>>> latestInformation = returnData
>>>>> };
>>>>> serializer.Serialize(
>>>>> new {eventType = MessageTypeEnum.InitialiseApp.****ToString(),
>>>>> data = responseData}, jsonMsg);
>>>>> message.DataJson = jsonMsg.ToString();
>>>>> }
>>>>> }
>>>>> On Thursday, November 15, 2012 5:22:10 PM UTC, Anton Venema wrote:
>>>>>> Simon,
>>>>>> - Which version are you using?
>>>>>> - What does your server-side configuration look like (web.config or
>>>>>> programmatically)?
>>>>>> - What does your client-side connect/subscribe code look like?
>>>>>> On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths <
>>>>>> si.grif...@gmail.com> wrote:
>>>>>>> Hi there,
>>>>>>> We have a .net application with a javascript client. When I set the
>>>>>>> server timeout to 9000 or higher, the AfterSubscribe event is being hit all
>>>>>>> the time (with just one client connected).
>>>>>>> If the timeout is lower than this then the event is only fired when
>>>>>>> the client first connects.
>>>>>>> Does anyone know what could be causing this please?
>>>>>>> Many thanks,
>>>>>>> Simon.
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "WebSync" group.
>>>>>>> To post to this group, send email to web...@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to websync+u...@**
>>>>>>> googlegroups.com.
>>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "WebSync" group.
>>>>> To post to this group, send email to web...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to websync+u...@**
>>>>> googlegroups.com.
>>>>> To view this discussion on the web visit https://groups.google.com/d/* >>>>> *ms**g/websync/-/_IKrsfcSNO0J<https://groups.google.com/d/msg/websync/-/_IKrsfcSNO0J>
>>>>> .
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "WebSync" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to websync+u...@**
>>> googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/websync/-/EW5vODiIH8cJ<https://groups.google.com/d/msg/websync/-/EW5vODiIH8cJ>
>>> .