server-sent-events

EventSource / SSE (Server-Sent-Svents) - Security

对着背影说爱祢 提交于 2019-12-04 13:48:48
I have read through the w3 spec @ http://www.w3.org/TR/eventsource/ for how EventSource/SSE works, but I cant find any good information about how a private stream should be created. Basically, I want to create a way to send private data to specific user-sessions. Both the ideas below seems to do what I want, but I am not so sure how secure they are. Example; does every browser connecting to the same EventSource URL receive the same data, and the browser keeps track of what event-name it wants? var source = new EventSource('/stream'); source.addEventListener('l0ngr4nd0mSessionID', function(e){

Recommended alternative to webkit for server-sent events on iOS [closed]

这一生的挚爱 提交于 2019-12-04 10:30:02
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I would like to receive Server-Sent Events in my native iOS app however am not using webkit/Safari. From what I've found, NSURLConnection is poor fit as it chunks response . I've also looked at ZTWebSocket library (obviously nice, but I'm seeking SSE, not web sockets). Would CocoaAsyncSocket be appropriate? Or limited to pure TCP Socket communication? I have a sneaking suspicion that I am missing

Flask server sent events socket exception

痴心易碎 提交于 2019-12-04 08:52:12
I am thinking of using SSE to push new data to the client and using Flot(javascript charting library) display "live" updates. My server runs on python Flask framework and I have figured out how to push the data to the client, but the problem occurs as soon as I leave the page: Exception happened during processing of request from ('127.0.0.1', 38814) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request self

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

喜欢而已 提交于 2019-12-04 07:52:30
问题 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 to reconnect indefinitely every few seconds until it succeeds. On Firefox 30, on the other hand, it will only try once and then you have to either refresh the page or handle the error event raised and manually reconnect. I much prefer the way Chrome

Is it possible to use gzip compression with Server-Sent Events (SSE)?

谁说胖子不能爱 提交于 2019-12-04 05:46:20
I would like to know if it is possible to enable gzip compression for Server-Sent Events (SSE ; Content-Type: text/event-stream). It seems it is possible, according to this book: http://chimera.labs.oreilly.com/books/1230000000545/ch16.html But I can't find any example of SSE with gzip compression. I tried to send gzipped messages with the response header field Content-Encoding set to "gzip" without success. For experimenting around SSE, I am testing a small web application made in Python with the bottle framework + gevent ; I am just running the bottle WSGI server: @bottle.get('/data_stream')

Using Django Server Sent Events with Database post save

一世执手 提交于 2019-12-04 04:48:45
I am trying to implement Server Sent Events(SSE) in Django Framework. It is clear to me that I can implement a view like this: @csrf_exempt def event_stream(request): def eventStream(): yield "data:Server Sent Data\n\n" response = HttpResponse(eventStream(), content_type="text/event-stream") response['Cache-Control'] = 'no-cache' return response But I want to trigger the SSE call whenever a new entry is made in a database table, from the post_save of the table, How I might be able to achieve that here since eventStream here is a generator function. Django is build around the request/response

Server sent events work, but with a massive time delay

喜夏-厌秋 提交于 2019-12-04 04:19:40
Ill start off by saying this works perfectly on my local machine, the js example below connects to stream.php and receives a continuous update of the servers current time every second. index.php var source = new EventSource("stream.php"); source.addEventListener('message', function(e) { console.log(e); }, false); source.addEventListener('open', function(e) { console.log(e); }, false); source.addEventListener('error', function(e) { if (e.readyState == EventSource.CLOSED) { console.log('closed'); } }, false); stream.php while(true) { // Headers must be processed line by line. header('Content

Handling event-stream connections in a Sinatra app

╄→尐↘猪︶ㄣ 提交于 2019-12-03 21:41:35
There is a great example of a chat app using Server-Sent Events by Konstantin Haase. I am trying to run it and have a problem with callbacks (I use Sinatra 1.3.2 and browse with Chrome 16). They simply do not run (e.g. after page reload), and therefore the number of connections is growing. Also, connection is closed in 30-60 sec unless one sets a periodic timer to send empty data, as suggested by Konstantin elsewhere. Can you replicate it? If yes, is it possible to fix these issues somehow? WebSockets work seamlessly in this respect... # ruby get '/stream', provides: 'text/event-stream' do

Scala: Receiving Server-Sent-Events

时光总嘲笑我的痴心妄想 提交于 2019-12-03 12:42:46
Set-up: A project I am working on has a pub/sub server with an HTTP interface. Subscription works by accepting server-sent-events. curl -X GET server:port/topics/news which will be pushed whenever a message is published to the given topic URL curl -X PUT server:port/topics/news -d "Politician Lies!" Problem: I have a scala project which needs to subscribe to this pub/sub server. The Play! framework is able to handle this by using PlayWS with Enumeratee + Iteratee. Unfortunately, the PlayWS library requires that a Play! Application is in scope and I am not using Play. Is there a library (with

Downside of using Server-Sent events for bidirectional client-server communication (instead of WebSockets)

橙三吉。 提交于 2019-12-03 09:08:21
问题 Recently I've found out of Server-Sent events as a much simpler alternative to WebSockets for doing push from the server. Most places that compare them (like here, here and here) say that if you don't need full duplex communications between client and server, then WebSockets is overkill and SSE are good enough. My question is what would be the downside of using SSE when you do need bidirectional communications (like a chat for example), using regular ajax requests for sending messages from