News for hackers. Stuff that matters.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by coltonv on Monday March 14, 2016 @05:56PM (#11285870)
i actually went through this debate a few days ago when deciding what to use for realtine updates on our new platform. I had previously used socket.io but decided I'd try just using straight websockets and not bothering backporting realtine updates to IE9. Really great decision IMO. The basic Websocket API is actually really easy to use. i got everything up and running in less than a day, the server is less than 100 lines, and the client side code is about 50 lines and completely resuable and DRY wherever i need realtime updates. Compare this to the 100kb (minified) and all sorts of boilerplate you have to write for socket.io, so in my opinion you're better off with straight WebSockets these days.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by XCSme on Monday March 14, 2016 @06:10PM (#11285949)
See this: https://gist.github.com/zeusdeux/5491cff541fb4ac4c142 I myself prefer the extra 100kb if I receive in exchange a more robust client/server architecture with browser fallback.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by coltonv on Monday March 14, 2016 @08:13PM (#11286563)
That link mentions that it's both a server and a client, which made me realize i didn't mention what i used server side. I used https://github.com/sitegui/nodejs-websocket/blob/master/READ... which is extremely easy to set up and use. i don't doubt the value of socket.io but I for my purposes it was not optimal.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by dcwca on Monday March 14, 2016 @06:55PM (#11286163)
> and the client side code is about 50 lines and completely resuable and DRY

Were you able to implement auto-reconnect with backoff? That's one of the most important features that something like Socket.io gives you.

Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by jkarneges on Monday March 14, 2016 @09:41PM (#11286910)
If you don't need fallback to HTTP, there are some alternative libraries that handle auto reconnect for pure WebSockets:

https://github.com/fanout/websockhop

https://github.com/joewalnes/reconnecting-websocket

Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by dtf on Tuesday March 15, 2016 @05:51AM (#11288518)
Also, if your traffic is basically one-way like in this example, don't forget Server-Sent Events, which are auto-reconnecting and well supported.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by coltonv on Monday March 14, 2016 @08:07PM (#11286539)
Right now just a 3 time retry with hard coded delay between each one.
Re:Real-Time Web Analytics Dashboard with NodeJs, Socket.io,... by mailanik on Tuesday March 15, 2016 @03:06AM (#11287984)
i recently made a messaging app something like appear.in using websockets in less than a day. Just added nodejs cluster support to it. Kind of easy to learn and easy set up made me love websockets.