Re:Ask HN: What is something you do for clients that consist...
by roadnottaken on Monday December 12, 2016 @01:07PM
(#13160208)
Can you say a little-more about the "sockets"? How do you implement this? I'm not even sure exactly what you mean, do you have an example? It sounds like a fun feature to implement so I'd love to hear more. Thanks
[ Parent
| on HN ]
Re:Ask HN: What is something you do for clients that consist...
by bestows on Monday December 12, 2016 @02:06PM
(#13160812)
Have a look into websockets. They are used to create an always open connection between the client and server. Meaning your application will not need to continually poll the server for updates.
Re:Ask HN: What is something you do for clients that consist...
by stephenr on Tuesday December 13, 2016 @02:14AM
(#13165130)
For notification type stuff (i.e. predominantly one way, server > client) Server Sent Events/EventSource is IMO a simpler, more appropriate solution:
It works over regular HTTP and has a built in method to tell the server the last seen message (i.e. to allow replaying old messages), and exposes the event type (i.e. the event: field in the event block sent from the server) for use with addEventListener in the browser.
It's supported by all non-MS browsers, and because it works over regular HTTP, it can be polyfilled in IE/Edge using long polling XHR.