nsq
nsq copied to clipboard
nsqadmin: update in real-time
It'd be great if we could see the numbers in nsqadmin (ex: Depth, Memory + Disk, Messages, Channels, etc.) updated in real-time via websocket.
Chiming in here quick: websockets are unnecessary for this, as you don't need two way communication. Just use Server Sent Events. They're trivial to implement in Go.
updated title :)
They also are easier to operate. No worrying about reconnect logic, they mostly "just work" for streaming updates.
:+1:
+1
Websockets have marginally more support across browsers (latest IE versions being the notable one missing from Server Sent Events).
http://caniuse.com/#search=server vs http://caniuse.com/#search=websocket
Does anybody have any significant opinion on which to use, with that in mind?
I would say whichever is simpler to implement - I'm not terribly concerned about IE compatibility, for example.
I'd say SSE--implementing it in Go is trivial, the client-side code is simpler (no need to manage connection state, etc.) and the main advantage of WS (the client can talk to the server) isn't something nsqadmin actually needs.
It's less elegant than a full SSE implementation, but as part of #323 it should be trivial to implement an automatic refresh on a configurable timer, with the client re-polling for new data over the nsqadmind REST endpoints. I think SSE should be tackled in a separate commit for this issue after that initial refactoring, but welcome input in #323 if there are any suggestions/concerns with that sort of interim solution.