antage / eventsource Goto Github PK
View Code? Open in Web Editor NEWServer-sent events for Go
License: MIT License
Server-sent events for Go
License: MIT License
Hi,
If I got multiple consumers with "private" channels*, should I create a new EventSource instance for each one or is there an internal way to handle this?
Hello,
I'm developping chat rooms based on Twitter hashtag with Server sent events.
I have a problem concerning the disconnection of the client. I run a goroutine to send messages to the client, but when the client disconnects, the goroutine still runs.
I don't know how to detect on the server side that the client is disconnected.
You can find a part of my code here : https://gist.github.com/Guiguillermo/f214fbda9aacec1ea5d9
Thanks !
I'm not seeing a good mechanism here to disconnect a consumer manually.
My use-case is this: a client will make a POST /some-route
which kicks off a back-end service and allows other clients to watch for SSE on GET /events
and I'm simply forwarding all output from the back-end service to the clients via es.SendMessage
. I would like to close the SSE connections on those clients when the back-end service is finished.
Do you have any ideas?
Thanks!
See #16 as example.
We should ensure all goroutines are exited before close all control channels and other stuff.
eventsource should have ability to specify additional http headers in SSE response.
Have you ever experienced an issue when the 200 OK + Content-Type is buffered up on non-local connections and are sent when there's enough data in the pipe or when some timeout is reached? I see this behaviour when I connect to my local dev server through ngrok.com proxy, and, what is much worse, it looks like such responses are immediately halted by Amazon ELBs (or at least this is how I currently interpret the fact that these requests are immediatelly marked as "cancelled" by Chrome)
I am quite confused on how to use handleFunc instead of http.handle with es instance.
Any example would be helpful. Thanks
Hello,
During streaming on a client side, I'm continuously getting an error, which drops connection with a server.
GET /stream net::ERR_INCOMPLETE_CHUNKED_ENCODING
Can you please advice, what could be a problem?
Thanks.
if i want auth use query or header,
how can do this?
if server want close connect, any api can do this?
X-Accel-Buffering is a header understood by nginx when proxying requests, to disable buffering.
I know that it's just one of many such custom headers, but it'd be nice to have at least the most important one supported.
Alternatively, a way to insert custom headers might be useful.
I did some quick benchmarks, it appears that each connection uses between 15-20K of memory. Thats not bad. Considering that each net.Listen() connection takes up 10K of memory and you implemented the SSE logic.
Can you add a license file to your code?
I am evaluating servers to use along with EventSource clients.
How many concurrent connected clients were you able to have on one cyclone instance?
(With a Node.js server I was able to handle up to >5000 concurrent event source streams)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.