6 ms·
Hi, I'm Andrew and I had this stupid frustration: in order to have a live streaming web plot in my page I am required to either read 10+ pages of JS integration
by grandrew 11y ago
Hi, I'm Andrew and I had this stupid frustration: in order to have a live streaming web plot in my page I am required to either read 10+ pages of JS integration docs, or pay $20+/mo, and usually both.
In the world of HTML5, EventSource and all the modern infrastructure that shouldn't be so complicated!
So I crafted this microservice in a couple of days to solve this unfairness.
It generates an SVG image that does everything automatically, you just need to do some GET requests to feed your live data. It is in early stage testing, so be free to post what you think of the idea and the code, I will be happy to discuss!
p.s. my microservice is currently hosted at scaleway ARM microserver and I am very excited about pushing it to the limits!
- ghubbard 11y ago> I am very excited about pushing it to the limits! Looks like you found them.
- grandrew 11y agoI ran out of 1024 open file descriptors limit... May be a bug or 1024 connections... :-/ investigating
- chatmasta 11y agoThe classic scaling problem! Justin.tv faced the same one. [0] > "a sign behind Emmett’s desk read “HAVE YOU CHECKED THE FILE DESCRIPTOR LIMITS?” Side note... does anyone know why the default FD limit is so low at 1024 on most machines? It seems like there's very little cost to changing it to a high value (e.g. 65535). [0] http://justinkan.com/three-stories http://justinkan.com/three-stories
- Isamu 11y agoThat is a classic. I would think the default is just an old vestige of mesozoic machine limitations. And its not like everybody is scaling up, most of the time it is indicative of a leak, and you would be happy to get the heads up.
- nemik 11y agoThis is very cool, thank you for making it! I just have one concern: Does the AGPLv3 license mean I need to open-source whatever other service I make that might be making use of this?
- grandrew 11y agoAGPLv3 means that if you use the _code_ provided at git repo, you should share whatever modifications you make; Using the service itself is no way affected. But not having any "Terms of Service" is really a lack here, will be fixing that soon
- untog 11y agoI do web dev for a living and I'm slightly embarrassed that this is the first time I've heard of the EventSource API. Why would I use it over Websockets, though? It appears that it does the same thing - keeps an HTTP connection open - but without the ability for the client to send anything back.
- grandrew 11y agoIn this particular case this is exactly what I need - to send server generated events with no way to talk back :) I just use the right tool for the right thing here
- drhayes9 11y agoMy favorite thing about EventSource/ServerSentEvents is that reconnection is handled for you by the browser. EventSource also works over straight HTTP without need to renegotiate the protocol, which is nice for hosts that don't support WebSockets.
- TN1ck 11y agoI wouldn't, EventSource isn't supported by IE yet[0]. [0] http://caniuse.com/#search=EventSource http://caniuse.com/#search=EventSource
- adrianpike 11y agoI've been using this polyfill for years in production with success: https://github.com/Yaffle/EventSource https://github.com/Yaffle/EventSource
- dclowd9901 11y agoI can think of many scenarios where the client needn't send anything back, notifications being an immediate example; I haven't dabbled with either, but I imagine reasoning about EventSource is probably a little bit easier than WebSockets.
- PeCaN 11y ago
- jalfresi 11y agoReally love the idea of embedding the EventSource and image update JavaScript in the SVG doc itself! Keeps the host page clean and tidy! Took me a while to get my head round where the python script was "generating" the svg. A really clean solution, love it!