0

Greetings StackOverflow.

I would like to hear from you if I understand the concepts of polling and pushing.

Let's say I have a WCF web service method sendUsers(), which sends some data from database from web service to our client. Let's say we have a simple chat app.

POLLING: If I want to achieve constant updates of who is online from web service method, I put timer for example inside Global.asax in asp.net client which calls web service method sendOnlineUsers() every 5 seconds(depends on timer) and updates data on client side.

PUSHING: I understand this as, every time client calls some method on client side to web service, you properly respond to client with DUPLEX callbacks with proper web service method.

Which means in theory means for example: - User logins to the chat, which triggers login() client side method, which calls addUser() webservice method and inserts himself at current online list in database. So when web service receives that call, it triggers callback method to ALL users, which updates data on client side of "online users" to ALL clients atm in chat, with this new data?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
sensei
  • 7,044
  • 10
  • 57
  • 125
  • yes, you got it right. another option to implement push is for the client side (asp.net) to expose an endpoint and the wcf service will call it when it has something to notify (this is sort of how things work behind the scenes in duplex bindings). – Yaron Naveh Jul 27 '13 at 21:11
  • Aha. So when duplex makes callback, it actually calls a method on client side(that method is the proxy method of webservice, which retrieves data from db and updates client side with latest data)? Is there any simple example of working with database methods? – sensei Jul 28 '13 at 22:18
  • database is not in the core of this process. the core is that the client has a proxy to call server methods, and it also has an in process serevr to retreive server responses. the server receives messages from the client proxy (note that proxy is only a term for client side code) and in its free time can call the client server methods (this is the callback affect). what the server does in the implementation is really up to the server, calling DB is just one option. – Yaron Naveh Jul 28 '13 at 22:28

0 Answers0