Questions tagged [eventsource]

For questions relating to the HTML5 SSE (Server Sent Events) API; the JavaScript object is called EventSource.

215 questions
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
14
votes
2 answers

Is any aws service suitable for sending real time updates to browser?

I'm developing a stocks app and have to keep users browser updated with pricing changes I don't need to access past data, browser just have to get current data whenever it changes is it possible to filter a dynamodb stream and expose an endpoint…
14
votes
1 answer

Testing a controller which includes ActionController::Live

I have a controller which includes the Rails ActionController::Live module. I am displaying the contents of a logfile, which is being read using FileTail gem, and using SSE from ActionController::Live like so: class LogsController <…
Gaurav Manchanda
  • 544
  • 5
  • 22
13
votes
0 answers

Flask: How to detect disconnection in infinite response generator?

In flask I have a page that is used with EventSource to receive updates/events. It's implemented in fairly trivial manner: @route('/updates') def updates(): def gen(): while True: update = make_update() yield…
elmo
  • 1,189
  • 1
  • 10
  • 35
11
votes
3 answers

Chrome net::ERR_HTTP2_PROTOCOL_ERROR 200 after a reconnect

I'm using Node server with an express app which handles a Server Sent Events stream. This is proxied via NginX with http2 enabled. The SSE events are consumed via EventSource in a React app. I'm sending a heartbeat message every 10 seconds to keep…
fabrice
  • 178
  • 1
  • 1
  • 8
9
votes
2 answers

EventSource named events using TypeScript

I'm trying to use an EventSource with Typescript but cannot type correctly the response when using named events. I tried const evtSource = new EventSource('/my-url'); const parseMyEvent = (evt: Event) => { const data: MyDataInterface =…
Renato Rodrigues
  • 165
  • 1
  • 10
9
votes
4 answers

GraphQL subscription using server-sent events & EventSource

I'm looking into implementing a "subscription" type using server-sent events as the backing api. What I'm struggling with is the interface, to be more precise, the http layer of such operation. The problem: Using the native EventSource does not…
elad.chen
  • 2,375
  • 5
  • 25
  • 37
9
votes
2 answers

Creating an RxJS Observable from a (server sent) EventSource

I would like to create a RxJs Observable from an EventSource (server sent events). I tried the following: import {Component, OnInit} from 'angular2/core'; import {Subject, Observable} from 'rxjs/Rx'; @Component({ selector: 'my-app', …
balteo
  • 23,602
  • 63
  • 219
  • 412
8
votes
2 answers

Is it ok to use Apache Kafka "infinite retention policy" as a base for an Event sourced system with CQRS?

I'm currently evaluating options for designing/implementing Event Sourcing + CQRS architectural approach to system design. Since we want to use Apache Kafka for other aspects (normal pub-sub messaging + stream processing), the next logical question…
8
votes
2 answers

Getting net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 when consuming event-stream using EventSource in ReactJs

I have a very simple node service exposing an endpoint aimed to use Server Send Events (SSE) connection and a very basic ReactJs client consuming it via EventSource.onmessage. Firstly, when I set a debug point in updateAmountState (Chrome Dev) I…
Jim C
  • 3,957
  • 25
  • 85
  • 162
8
votes
3 answers

Should Spring SseEmitter.complete() trigger an EventSource reconnect - how to close connection server-side

I'm trying to set up a Spring SseEmitter to send a sequence of updates of the status of a running job. It seems to be working but: Whenever I call emitter.complete() in in my Java server code, the javascript EventSource client calls the registered…
xdhmoore
  • 8,935
  • 11
  • 47
  • 90
8
votes
1 answer

how the server send message SSE worked in multiple server instance environments

I have a question on how to make SSE worked in multiple server environments. In UI, there are two steps: 1. source = new EventSource('http://localhost:3000/stream'); source.addEventListener('open', function(e) { …
user3006967
  • 3,291
  • 10
  • 47
  • 72
7
votes
2 answers

SSE events are not reaching client until res.end() is called

The same code used to work before but i dont know why it is not working now.Please help. My problem is that when i use SSE for real time data sharing.The data object which should be sent on res.write(data:${JSON.stringify(dataObject)}\n\n) is not…
7
votes
2 answers

Why doesn't server-side script stop when EventSource is closed?

TL;DR update: Whether closing an EventSource from the client or closing the client entirely, php continues to execute on the backend and fails to report the correct value for connection_aborted(). Why might this be? I have been all over Google and…
SheffDoinWork
  • 743
  • 2
  • 8
  • 19
7
votes
0 answers

Filter results in loopback change-stream

does Strongloop Loopback support filtering in change-streams? The following works for all model changes, but I am only interested in changes of parts of the model. Can I add filtering to the EventSource-URL? var src = new…
tdeer
  • 135
  • 1
  • 6
1
2 3
14 15