Questions tagged [server-sent-events]

Server-Sent Events (SSE) are a a part of the HTML5 specification. SSE allows a uni-directional persistent connection between a client and server, such that the client makes only a single request and the server keeps pushing data to the client continuously, until the connection is closed.

Resources

1769 questions
1184
votes
4 answers

What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?

I have tried reading some articles, but I am not very clear on the concepts yet. Would someone like to take a shot at explaining to me what these technologies are: Long Polling Server-Sent Events Websockets Comet One thing that I came across every…
user1437328
  • 15,546
  • 9
  • 34
  • 44
1178
votes
7 answers

WebSockets vs. Server-Sent events/EventSource

Both WebSockets and Server-Sent Events are capable of pushing data to browsers. To me they seem to be competing technologies. What is the difference between them? When would you choose one over the other?
Mads Mobæk
  • 34,762
  • 20
  • 71
  • 78
124
votes
5 answers

Server-sent events and php - what triggers events on the server?

All, HTML5 Rocks has a nice beginner tutorial on Server-sent Events (SSE): http://www.html5rocks.com/en/tutorials/eventsource/basics/ But, I don't understand an important concept - what triggers the event on the server that causes a message to be…
mattstuehler
  • 9,040
  • 18
  • 78
  • 108
92
votes
8 answers

Websocket transport reliability (Socket.io data loss during reconnection)

Used NodeJS, Socket.io Problem Imagine there are 2 users U1 & U2, connected to an app via Socket.io. The algorithm is the following: U1 completely loses Internet connection (ex. switches Internet off) U2 sends a message to U1. U1 does not receive…
igorpavlov
  • 3,576
  • 6
  • 29
  • 56
79
votes
2 answers

Server-Sent Events vs Polling

Is there a big difference (in terms of performance, browser implementation availability, server load etc) between HTML5 SSEs and straight up Ajax polling? From the server side, it seems like an EventSource is just hitting the specified page every ~3…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
64
votes
2 answers

What technology does Google Drive use to get real-time updates?

What technology does Google Drive use to do real-time? When I type in a Google Drive document that is being accessed by multiple users, the Chrome Developer Tools Network tab shows that there are no WebSockets. I see that the two most frequent types…
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
57
votes
2 answers

How do server-sent events actually work?

So I understand the concept of server-sent events (EventSource): A client connects to an endpoint via EventSource Client just listens to messages sent from the endpoint The thing I'm confused about is how it works on the server. I've had a look at…
Ahmed Nuaman
  • 12,662
  • 15
  • 55
  • 87
54
votes
4 answers

Can Server Sent Events (SSE) with EventSource pass parameter by POST

I'm using Html5 Server Sent Events. The server side is Java Servlet. I have a json array data wants to pass to server. var source = new EventSource("../GetPointVal?id=100&jsondata=" + JSON.stringify(data)); If the array size is small , the server…
Tom Cheng
  • 1,299
  • 4
  • 14
  • 16
52
votes
7 answers

Is an EventSource (SSE) supposed to try to reconnect indefinitely?

I'm working on a project utilizing Server-Sent-Events and have just run into something interesting: connection loss is handled differently between Chrome and Firefox. On Chrome 35 or Opera 22, if you lose your connection to the server, it will try…
rhyek
  • 1,790
  • 1
  • 19
  • 23
46
votes
2 answers

Is there a Microsoft equivalent for HTML5 Server-Sent Events?

I am using HTML5 Server-Sent Events as follows: SSEUpdate = new EventSource("http://example.com/update.php"); SSEUpdate.onmessage = function(e){ console.log(e.data); } It does not work in IE11. (Error in console: 'EventSource' is…
45
votes
4 answers

Server sent events and browser limits

I have a web application that listens for Server Sent Events. While I was working and testing with multiple windows open, things were not working and I banged my head for several times looking in the wrong direction: eventually, I realized that the…
39
votes
2 answers

What is the difference between Push API and Server Sent Events?

From the documentation I could figure out that Push API and Server Sent Events both are half duplex but why two different technologies for the same functionality? Is there something more significant in Push API?
Rishul Matta
  • 3,383
  • 5
  • 23
  • 29
30
votes
2 answers

cURL - Structuring request to validate server sent events

I am new to cURL and server sent events. I know how to build a simple GET, POST requests using cURL and getting response. Also, theoretically I am aware that server sent events are handled by creating a listener to event source but I am not sure how…
Obj-Swift
  • 2,802
  • 3
  • 29
  • 50
30
votes
3 answers

JavaScript EventSource SSE not firing in browser

I have been developing a nodejs server to provide server-side-events for a new website I am developing in HTML5. When I telnet to the server it works correctly, sending me the required HTTP response headers followed by a stream of events that i am…
Dan
  • 739
  • 1
  • 6
  • 8
29
votes
2 answers

What the difference between `onmessage` and `.addEventListener`?

I'm trying to get data with server-sent event, what the different using source.onmessage vs source.addEventListener?
rezafahlevi08
  • 347
  • 1
  • 5
  • 10
1
2 3
99 100