server-sent-events

Java Servlet does not stop Push notifications

爷,独闯天下 提交于 2019-12-07 20:27:09
问题 I have a servlet which sends HTML5 server sent events to the jsp client. The servlet sends data to the client every one second. The jsp client instantiates a new eventsource and recieves the data. When the window is about to close, the jsp client closes eventsource at the "beforeunload" event (shown in the code below). However, I have noticed that even after the client closes the eventsource and the browser exits, the server continues sending data. As far as the documentation on eventsource

SSE Server Sent Events - Client keep sending requests (like pooling)

大兔子大兔子 提交于 2019-12-07 16:26:56
问题 How come every site explains that in SSE a single connection stays opened between client and server "With SSE, a client sends a standard HTTP request asking for an event stream, and the server responds initially with a standard HTTP response and holds the connection open" And then, when server decides it can send data to the client while what I am trying to implement SSE I see on fiddler requests being sent every couple of seconds For me it feels like long polling and not a one single

SSE implementation in Spring REST

房东的猫 提交于 2019-12-07 09:35:34
问题 Can anybody provide an example for SSE ( Server sent events) using Spring Rest ? Basically i have a request and the response for it would be sent by the server in multiple chunks. I would like to have the server and client implementation in Spring REST Api without third party rest api like jersey. 回答1: There isn't any direct support for SSE in Spring currently but it looks like it will be available in 4.2 which is in RC2 right now You can see the details here https://jira.spring.io/browse/SPR

Angular2/typescript and SSE (EventSource)

天涯浪子 提交于 2019-12-07 05:04:36
问题 First of all, I`m quite new to ng2 and typescript. What Im trying to accomplish is to implement Server-Sent events in Angular2 component. I have followed the examples mentioned in earlies posts here, but my problem is that the "EventSource" object is unrecognized (red underline, in VS Code). Im not sure if I`m missing some references... My references are: <!-- IE required polyfills, in this exact order --> <script src="node_modules/es6-shim/es6-shim.min.js"></script> <script src="node_modules

While loops for server-sent events are causing page to freeze

*爱你&永不变心* 提交于 2019-12-06 18:23:05
问题 I am currently working on a chat that uses Server-Sent Events to receive the messages. However, I am running into a problem. The server-sent event never connects and stays at pending because the page doesn't load. For example: <?php while(true) { echo "data: This is the message."; sleep(3); ob_flush(); flush(); } ?> I expect that every 3 seconds, "data: This is the message." will be outputted. Instead, the page just doesn't load. However, I need this behavior for server-sent events. Is there

SSE (Server-sent events) not working

霸气de小男生 提交于 2019-12-06 16:59:28
I'm testing SSE in my Rails app (server: Puma) in Chrome but they are not triggered: setTimeout((function() { console.log("log1"); var source = new EventSource('/websites/21/backlinks/realtime_push'); source.addEventListener('pagination', function(e) { console.log("log2"); var data = JSON.parse(e.data); $('#pagination').html(data.html); }); }), 1); only "log1" is written to console. In developer tools I see XHR requests every time server pushes something (each second) but the response is empty - not sure if developer tools just don't show it or something else is wrong. curl http://localhost

Server-sent events inside Laravel

徘徊边缘 提交于 2019-12-06 10:40:25
问题 I am trying to implement the HTML5 Server-sent events inside Laravel 4, I found this repo the script uses server.php file to get it working. My question is how would I implement it to get it working with a Controller instead of a plain php file? So in the Javascript side it will look like this: var source = EventSource('/notifications'); I tried this just to see if I get a response: class NotificationsController extends BaseController { public function index() { $response = Response::view(

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

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:45:12
问题 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

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

蹲街弑〆低调 提交于 2019-12-06 06:22:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 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

Java Servlet does not stop Push notifications

[亡魂溺海] 提交于 2019-12-06 04:25:10
I have a servlet which sends HTML5 server sent events to the jsp client. The servlet sends data to the client every one second. The jsp client instantiates a new eventsource and recieves the data. When the window is about to close, the jsp client closes eventsource at the "beforeunload" event (shown in the code below). However, I have noticed that even after the client closes the eventsource and the browser exits, the server continues sending data. As far as the documentation on eventsource goes, using eventsource.close() is enough to stop client from reconnecting to the server and the server