opkbrokers.blogg.se

Messaging for web
Messaging for web







WebSockets - Use a WebSocket object to create a two-way communication channel so the server can send a message to the client and vice versa at any time. The disadvantage of server push is that Internet Explorer and Edge do not currently support it, and the web server doesn't know if a client has stopped listening until the server attempts to send a message. This technique is commonly called server push. Server-sent events - Use an EventSource object to create a callback that executes when the web server sends new messages. The disadvantage of polling is that the server cannot transmit the message until the client asks for it. This technique is commonly called polling. XMLHttpRequest - Use the XMLHttpRequest object to make periodic requests from the client (web browser) to the web server to see if new information is available. There are three common techniques to solve this problem: This won't be good for real-time chats or anything, but for "I parsed your 200M excel file" it should be fine. Assuming this is a semi long running process, polling every 2-5 seconds should not upset your users too much. I personally deal with a lot of old browsers so the ajax polling would be my go to guy. If you take a look at that link you will see in the body of the article the list of browsers supporting the technology, and depending on your use case, you may or may not wish to investigate further.

messaging for web

To actually use push technology (which is precisely what you're asking, but not necessarily what you really need), you should take a look at WebSockets. It's not ideal, given your question, but it is certainly feasible and pretty reliable. For example, setting up a resource that returns your "completed" message when the server side processing is complete. The first, most common (and safest) solution to this will probably be AJAX long-polling, that is, setting up an ajax query on the client to periodically make a request and do something with the response. Off the top of my head, two possible solutions come to mind:









Messaging for web