How POKEIN identifies clients for doing SERVER PUSH ? Does ClientIDs in it are IPs?
I have a web application, where users will see notifications for their new messages, I want to push the notifications to the users who are already logged in.
I have seen that I can do it using Server Push of PokeIn, I have tried and understood the simple application using it, but I am not getting the ClientID thing.
The ClientId it saves in "OnClientConnected" is a simple integer, so how does it recognizes clients and calls functions on them ?
Also, it is written that it uses a hybrid long polling approach, can somebody please explain me what is this?
I will not be able to implement without having sufficient knowledge of it.
Does saving the ClientID in the database for logged in user and then pushing data using th开发者_运维技巧is will do ?
UPDATE:
Even from requests within the same browser window or tab, the ClientId received every time on every request is different, so I had to include the Handler in my master page and on every request, I had to map the ClientId received to the Logged In user, so that I can send messages to him.
Can't I just map the (ClientId to LoggedIn UserId) only once on LogIn and then use that same ClientId to send him messages ?
ClientID represents the identification key of the specific client view of your application and subject to change on each time. It helps you to manage and target specific views by keys. On the other hand, you can still use ASP.NET session ids with PokeIn client ids. The only difference is, if any user opens your application on the different tabs of same browser, each tab will have a unique client id. Actually, this is a great functionality you may need. On the other hand, PokeIn also notifies you when a client is disconnected (almost instantly)..
You may reach session id by the client id; CometWorker.GetSessionId(string ClientId)
or client ids for a session id by; CometWorker.GetClientIdsBySessionId(string sessionId)
Additionally, if you don't want to use client id system (which is very useful), you may choose the "Joint" option. It helps you the send and receive messages from the client with the name you have defined. (There is a sample for the "Joint" feature in here)
Because PokeIn provides various connection options, you don't have to think about the approach behind it when you work with PokeIn. It simply provides benefits from the various solutions. More information can be accessible from : "FAQ" and "Advanced Tutorial" (http://www.pokein.com/Help/AdvancedTutorial.aspx)
At last, you don't have to save PokeIn client id to the database. PokeIn manages your server side objects per each client efficiently. I suggest you to check the samples and tutorials.
As an answer for your update, you are free to use Joint feature of PokeIn when you need shared server side instances for the clients or consistent naming for the clients.
精彩评论