Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
AfterSubscribe event fired continuously when server timeout set to > 8 seconds
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Simon Griffiths  
View profile  
 More options Nov 15 2012, 12:20 pm
From: Simon Griffiths <si.griffiths...@gmail.com>
Date: Thu, 15 Nov 2012 09:20:13 -0800 (PST)
Local: Thurs, Nov 15 2012 12:20 pm
Subject: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Venema  
View profile  
 More options Nov 15 2012, 12:22 pm
From: Anton Venema <anton.ven...@frozenmountain.com>
Date: Thu, 15 Nov 2012 09:22:09 -0800
Local: Thurs, Nov 15 2012 12:22 pm
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

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?

Anton Venema
Frozen Mountain Software
604-227-2458 (Canada)
919-300-5520 (United States)
888-379-6686 (Extension 102)
www.frozenmountain.com

On Thu, Nov 15, 2012 at 9:20 AM, Simon Griffiths
<si.griffiths...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Griffiths  
View profile  
 More options Nov 16 2012, 9:19 am
From: Simon Griffiths <si.griffiths...@gmail.com>
Date: Fri, 16 Nov 2012 06:19:59 -0800 (PST)
Local: Fri, Nov 16 2012 9:19 am
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

Hi Anton, thanks for the quick response.

-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();
    }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Venema  
View profile  
 More options Nov 16 2012, 10:51 am
From: Anton Venema <anton.ven...@frozenmountain.com>
Date: Fri, 16 Nov 2012 07:51:53 -0800
Local: Fri, Nov 16 2012 10:51 am
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

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)?

Anton Venema
Frozen Mountain Software
604-227-2458 (Canada)
919-300-5520 (United States)
888-379-6686 (Extension 102)
www.frozenmountain.com

On Fri, Nov 16, 2012 at 6:19 AM, Simon Griffiths
<si.griffiths...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Griffiths  
View profile  
 More options Nov 19 2012, 6:03 am
From: Simon Griffiths <si.griffiths...@gmail.com>
Date: Mon, 19 Nov 2012 03:03:50 -0800 (PST)
Local: Mon, Nov 19 2012 6:03 am
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

Hi Anton,

web.config:

  <WebSync>      <server timeout="9000" reconnectInterval="0" />  </WebSync>

connect code:

    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)

Thanks,

Simon.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Venema  
View profile  
 More options Nov 19 2012, 12:05 pm
From: Anton Venema <anton.ven...@frozenmountain.com>
Date: Mon, 19 Nov 2012 09:05:31 -0800
Local: Mon, Nov 19 2012 12:05 pm
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

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.

A good rule of thumb is this:

Client-Side Timeout + Server-Side Timeout = Client-Side Stream Timeout

In your case:

2000 + 9000 = 11000

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.

Anton Venema
Frozen Mountain Software
604-227-2458 (Canada)
919-300-5520 (United States)
888-379-6686 (Extension 102)
www.frozenmountain.com

On Mon, Nov 19, 2012 at 3:03 AM, Simon Griffiths
<si.griffiths...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Griffiths  
View profile  
 More options Nov 21 2012, 7:28 am
From: Simon Griffiths <si.griffiths...@gmail.com>
Date: Wed, 21 Nov 2012 04:28:51 -0800 (PST)
Local: Wed, Nov 21 2012 7:28 am
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

Thanks Anton, that's very helpful.

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Venema  
View profile  
 More options Nov 21 2012, 11:50 am
From: Anton Venema <anton.ven...@frozenmountain.com>
Date: Wed, 21 Nov 2012 08:50:28 -0800
Local: Wed, Nov 21 2012 11:50 am
Subject: Re: AfterSubscribe event fired continuously when server timeout set to > 8 seconds

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.

See "stream" here:
http://docs.frozenmountain.com/websync3/#class=fm.websync.initializeC...

The regular client-side "timeout" is for normal, synchronous requests (like
connect, subscribe, etc.) where a response is expected back right away.

See "timeout" here:
http://docs.frozenmountain.com/websync3/#class=fm.websync.initializeC...

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.

See "timeout" here:
http://docs.frozenmountain.com/websync3/#class=server-web-config-sett...

Anton Venema
Frozen Mountain Software
604-227-2458 (Canada)
919-300-5520 (United States)
888-379-6686 (Extension 102)
www.frozenmountain.com

On Wed, Nov 21, 2012 at 4:28 AM, Simon Griffiths
<si.griffiths...@gmail.com>wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »