Tutorial by Examples

You can setup your client browser to listen in incoming server events using the EventSource object. You will need to supply the constructor a string of the path to the server' API enpoint the will subscribe the client to the server events. Example: var eventSource = new EventSource("api/my-ev...
An event stream to the server can be closed using the EventSource.close() method var eventSource = new EventSource("api/my-events"); // do things ... eventSource.close(); // you will not receive anymore events from this object The .close() method does nothing is the stream is already...
You can bind event listeners to the EventSource object to listen to different events channels using the .addEventListener method. EventSource.addEventListener(name: String, callback: Function, [options]) name: The name related to the name of the channel the server is emitting events to. callb...

Page 1 of 1