-
January 28th, 2009, 05:29 AM
#1
onEngineReady vs onServerConnected
According to my understanding, onEngineReady is an event that triggers when the engine page is created. It doesn't make any sense about whether the webclient is successfully connected to the server. [even the server is not running it will trigger onEngineReady]
Is there a straight method to know exactly when the client is connected with the server, rather than periodically check the engine status[some thing like onServerConnected ]?
Originally I want delay the addTable until I verify that the server is ready to subscribe. Is there any communication between webclient and server even before adding any push table or it starts communication right after adding any table?
Thanks.
P:S: Can you please post the sequence of communication between webclient and server to clarify this better.
-
January 29th, 2009, 09:21 AM
#2
We can't produce a detailed chart of the scenario in short time. Please, see the notes below.
When the Engine is first created, the onEngineCreation callback is invoked and no connection attempt to the Server is performed. It is invoked only to one page, therefore this is the place in which you can ask for the connection, by calling changeStatus("STREAMING").
Then, the onEngineReady callback is invoked for all pages, so as to allow each page to get a pointer to the Engine object.
This, indeed, happens concurrently with (i.e. either before or after) the connection to the Server.
Once provided with a pointer to the Engine, a page can know the connection status through getStatus and can be informed through onStatusChange (where STREAMING and POLLING mean "connected", DISCONNECTED and CONNECTING mean "not connected" and STALLED means "not sure it is still connected; let's see what happens").
Hence, a suggested code may be the following:
Adding push tables is also independent with respect to the connection to the Server.
You can add and remove tables at any time. If the connection is not active, adding table does not request a connection; however, as soon as the connection is requested through changeStatus, the table subscription is forwarded to the Server.
Hence, there should be no need to delay adding tables.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 10:32 AM.
Bookmarks