Support for Server Sent Events
See original GitHub issueDoes the new LWS support eventsource connections to backend services? The previous version was working fine. On version
$ ws --version
2.0.0-pre.4
eventsource
(aka Server Sent Events with accept: 'text/event-stream',
) seem to always return empty responses. When using -v
to see the output, the data field is empty (see all the way at the end)…
{ 'socket-data': { id: 5, bytesRead: 730, bytesWritten: 0 } }
{ 'rewrite-proxy-req':
{ req:
Url {
protocol: 'http:',
slashes: true,
auth: null,
host: '**myhostname**:8080',
port: '8080',
hostname: '**myhostname**',
hash: null,
search: '?&streamId=13d783492c76a9be5fbb34bdaeb936c9691fd893fd67a11ed99051c55c855259',
query: '&streamId=13d783492c76a9be5fbb34bdaeb936c9691fd893fd67a11ed99051c55c855259',
pathname: '/path/to/stream',
path: '/path/to/stream?&streamId=13d783492c76a9be5fbb34bdaeb936c9691fd893fd67a11ed99051c55c855259',
href: 'http://**myhostname**:8080/path/to/stream?&streamId=13d783492c76a9be5fbb34bdaeb936c9691fd893fd67a11ed99051c55c855259',
id: 3,
method: 'GET',
headers:
{ host: '**myhostname**:8080',
connection: 'keep-alive',
accept: 'text/event-stream',
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
dnt: '1',
referer: 'http://**myhostname**/path/to/app/',
'accept-encoding': 'gzip, deflate',
'accept-language': 'en-US,en;q=0.8',
cookie: 'JSESSIONID=15A2;and_other_cookies..' },
rejectUnauthorized: false },
data: '' } }
See the last line has empty data: data: ''
.
But when I hit my downstream service directly I get periodic events as expected. Is there a new middleware I need to configure/enable to turn on SSE for rewrite requests?
I haven’t tried websockets so it may or may not behave the same way.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Server-sent events | Can I use... Support tables for ... - CanIUse
Server -sent events · Global · Chrome · Edge * · Safari · Firefox · Opera · IE · Chrome for Android.
Read more >Using server-sent events - Web APIs | MDN
The server-side script that sends events needs to respond using the MIME type text/event-stream . Each notification is sent as a block of...
Read more >HTML SSE API - Server-Sent Events - W3Schools
A server-sent event is when a web page automatically gets updates from a server. This was also possible before, but the web page...
Read more >Server-sent events - Wikipedia
Server -Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via an HTTP connection,...
Read more >Announcing support for Server-Sent Events (SSE) | Ably Blog
SSE is commonly used to send message updates, new events, or continuous data streams to a browser client. It's designed to enhance native,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fantastic. Works great… now
-v
verbose output shows:👍
this is fixed in v2.0.0-pre2.4, please reinstall
thanks again, let me know if you find anything else!