The client (desktop app) pulls data…but I want the server (web app) to push data

ⅰ亾dé卋堺 提交于 2019-12-03 04:28:22

What you're describing is "server push", which these days is often called "COMET". Using those keywords in a web search should turn up a lot of useful information.

The most common technique for this is called a "hanging GET". The client sends a GET request to a specific URL, and the server accepts the connection but delays sending a response until it has data to send. When the client receives the response it sends another GET so it's ready for another message.

You could use WCF callbacks - this are a web service where you can subscribe to notifications from a client and the server will send messages to subscribed clients. I have a beginners guide on my blog.

David Robbins

You may be interested in the SO question. What you are describing sounds like a Comet application - server push to a client.

Check out WebSync; it's a Comet solution for ASP.NET/IIS, but there's also a full .NET client available, which enables integration with thick clients, windows services, etc. So it sounds like it should fit the bill pretty nicely.

If you can leave a socket open, the client can connect to the server and the server can just push data down the socket when appropriate. There is no reason why the side that initiates the connection must always be the one to initiate the data transfer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!