Questions tagged [event-stream]

This tag is for questions relating to event streams in HTTP. Event streams are an easy way for a server to have a continuous connection with the client and send data back and forth.

137 questions
4
votes
1 answer

Using HttpClient to create EventStream request

I used the following code to get an event stream from server: getStream(): Observable { return new Observable(obs => { const source = new EventSource(`http://backend/api/stream`); source.onmessage = (ev): void =>…
noamyg
  • 2,747
  • 1
  • 23
  • 44
4
votes
1 answer

Non-blocking streaming of data between two Quarkus services (Vert.x with Mutiny in Java)

Update! I have fixed minor bugs in the sample code after solving some of the problems that were irrelevant to the main question which is still about non-blocking streaming between services. Background info: I'm porting a Spring WebFlux service under…
Péter Veres
  • 955
  • 1
  • 10
  • 25
4
votes
2 answers

Modelling an event stream by manually polling entities that changed from a Rest API

I'm tasked with creating an event stream whereby I have an automated poller (set at 10minute intervals) to retrieve all entities that changed within the last 10minutes. Now, the business logic dictates that we only create new update events when…
ugotchi
  • 1,003
  • 1
  • 12
  • 32
4
votes
3 answers

How can I get the last event from an Event Store stream with only one HTTP request?

All the docs I can find seem to suggest I need two http requests to do this: one to the stream, giving me a link to the last event, and then one to follow that link. That seems bizarre, isn't there a way to do this with just one request?
alksdjg
  • 1,019
  • 2
  • 10
  • 26
3
votes
1 answer

Is there a way to get a single response from a text/event-stream without using event listeners?

I'm writing a script in Google Sheets to retrieve a value from an API. The API provides text/event-stream responses ~every 10 seconds. Is there a way I can retrieve a single response without using async functions or event listeners? I'm not very…
3
votes
0 answers

How to mock Server Sent Events SSE aka EventSource?

In my angularjs application, I have functionality where I am using SSE in a following way. The code is in a third party library, var source = new EventSource('usr_management.php'); source.addEventListener('newuser', function(e) { // business…
3
votes
3 answers

nginx buffering flask event-stream in Docker image

I have a REST API backend with python/flask and want to stream the response in an event stream. Everything is running inside a docker container with nginx/uwsgi (https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/). The API works fine until it…
SumNeuron
  • 4,850
  • 5
  • 39
  • 107
3
votes
0 answers

SseEmitter MessageBodyWriter not found for media type=text/event-stream

I am trying to get server-sent events working with a JavaScript web client and a Spring Boot 1.5.7 application. I get the following error in the server log when the SseEmitter is returned from the REST endpoint when the client initially…
Ens
  • 308
  • 3
  • 15
3
votes
1 answer

Strange chrome behavior in Developer Tools -> Network (cannot monitor EventStream/Server Sent Events)

I am using SignalR with Server Sent Events on my site and I was able to debug that pretty well in Chrome using the developers tab by clicking on the request and then selecting EventStream tab. But recently something weird has happened, every time I…
3
votes
1 answer

How can I connect to a Rails SSE streaming page in an Android application (Java)?

I have a rails route set up in my backend that uses ActionController::Live to stream server-sent events (HTML5 SSE, content-type data/event-stream). Ideally, I would like to interface directly with this route in my Android frontend using some Java…
Dennis L
  • 1,713
  • 14
  • 21
3
votes
1 answer

What's the difference between event-stream.through and event-stream.map

According to the documentation in event-stream, seems like the difference of this two method is sync or async. But I'm still not sure what the difference really means.
MorrisLiang
  • 702
  • 2
  • 7
  • 20
2
votes
2 answers

How to get events instantly using SSE?

I'm currently trying to use Server-Sent Events using PHP, but they are not firing instantly on the browser. Here is my code:
Gugu72
  • 2,052
  • 13
  • 35
2
votes
2 answers

NATS JetStream: Is it possible to explicitly ask from JetStream to (re)send the last few messages it received in subject foo.*?

Essentially what the subject says. I'm wondering if JetStream can be queried in a way that allows us to refetch either the last 15 messages of subject "foo.*" or the messages that JetStream received on subject "foo.*" in the last 1.5 seconds. If…
XDS
  • 3,786
  • 2
  • 36
  • 56
2
votes
1 answer

Is it possible to consume text/event-stream with JavaScript in a WebBrowser?

We have a Rest Service that returns a text/event-stream from a POST endpoint, which contains a series of JSON Objects. (It is a Spring Boot / Kotlin RestController that returns a kotlinx.coroutines.flow.Flow) Now we want to consume…
2
votes
1 answer

NodeJS: How to read from two files and write to single output file using pipes?

Context I am using event-stream module to help me in reading and writing to these local files for which I hope to return a resulting file. Long story short, the 2 input files(sent through express API as multipart/form-data) I am expecting can be…
Ben
  • 23
  • 4
1
2
3
9 10