Server Sent Events with spring-cloud-gateway

See original GitHub issue

I am using spring-cloud-gateway v2.0.0.M5 to proxy another spring boot application that uses Server Sent Events (SSE) to send some notifications to the GUI.

When I hit the notification server directly, it reaches GUI almost immediately after being published. However when I access notification server through spring-cloud-gateway, there is a lag between event publish and being received in the GUI. spring-cloud-gateway server seems to be batching the requests and flushes to the GUI in around a minute or so.

Is there a workaround to disable this behaviour. I don’t want a lag in the event publishing and delivery to the GUI. I suspect this is happening because transfer-encoding begin chunked in the response headers.

Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://localhost:63342
Content-Type:text/event-stream;charset=UTF-8
Date:Tue, 16 Jan 2018 01:57:52 GMT
transfer-encoding:chunked
transfer-encoding:chunked
Vary:Origin
X-Application-Context:notification-ms:dev:8030
X-Response-Default-Foo:Default-Bar

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
spencergibbcommented, Feb 13, 2018

Turns out it had nothing to do with the header, but properly flushing the response for streaming media types.

1reaction
spencergibbcommented, Sep 30, 2019

Please learn how to properly format code and logs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-Sent Events in Spring - Baeldung
Simply put, Server-Sent-Events, or SSE for short, is an HTTP standard that allows a web application to handle a unidirectional event stream and ......
Read more >
Server Sent Events with Spring Cloud Gateway - Stack Overflow
A reactive Spring Boot application is used to generate Server Sent Events for clients subscribed by a key, e.g: @GetMapping(path = "/sse" ...
Read more >
Server-Sent Events (SSE) in Spring 5 with Web MVC and Web ...
Server -Sent Events (SSE) is a simple technology to implement asynchronous server-to-client communication for specific web applications.
Read more >
Spring Cloud Gateway
This project provides an API Gateway built on top of the Spring Ecosystem, including: Spring 5, Spring Boot 2 and Project Reactor. Spring...
Read more >
Server Sent Events with spring-cloud-gateway - Bountysource
I am using spring-cloud-gateway v2.0.0.M5 to proxy another spring boot application that uses Server Sent Events (SSE) to send some ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found