Closed mark-hahn closed 8 years ago
Couple of things:
transfer-encoding
to identity
? SSE should use chunked
(and sse-channel sends that header automatically, iirc)status
, but you are listening to the message
event. Instead, hook up an event listener on status
. Eg: evtSource.addEventListener('status', function(e) { /* ... */ });
If you're still having trouble getting it to work, try using curl and checking that messages are actually being broadcasted:
curl http://localhost:2340/channel
hook up an event listener on status
That fixed it. Thanks very much. Maybe this should be in the readme. Maybe a short section on what to do in the browser. The readme currently assumes the user knows SSE in advance. I stupidly looked for a module to run in the browser until I found out it wasn't needed. If I get a chance I'll do a PR.
SSE should use chunked
Chrome threw an error saying chunked can't be used. I also googled it and found that chunked is considered a relibility problem.
"Authors are also cautioned that HTTP chunking can have unexpected negative effects on the reliability of this protocol. Where possible, chunking should be disabled for serving event streams unless the rate of messages is high enough for this not to matter." From https://html.spec.whatwg.org/multipage/comms.html#authoring-notes
Edit: Weird. I commented out the identity header and had no problem. Apparently that error was triggered by my problem, which makes no sense. I didn't imagine the error.
Thanks again for the fast response.
Thanks for the feedback on the transfer-encoding, learn something new every day :-)
I'll see if I can find the time to make a few notes in the readme about browser usage.
Thanks again for the feedback. I've added some client usage notes to the readme: https://github.com/rexxars/sse-channel/commit/6d6f2cac8590b9aedec763d7afdaa97c12ee7379
I'm having problems getting events to come through. I think I have everything set up (but I am often wrong).
getConnectionCount
shows one connectionsend
connect
event as expectedopen
event works.error
so I'm confident there is no errorsetInterval
in both the browser and server showing good status repeatedlyServer code ...
Client code ...
If you can't think of any easier way to debug I'll try capturing packets.
Ubuntu 14.04 node 0.12.9 sse-channel 2.0.0 chrome 47.0.2526.106