-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
Description
Bug report
Server Side Event is Not Working
Describe the bug
i am using express-sse (https://www.npmjs.com/package/express-sse) for server side event server , i point to /stream as an endpoint to SSE
var SSE = require('express-sse');
var sse = new SSE(["array", "containing", "initial", "content", "(optional)"]);
nxt.prepare()
.then(() => {
app.get('/stream', sse.init);
})
and in the client side
componentDidMount() {
this.source = new EventSource('/stream')
this.source.onmessage = function(e) {
console.log(e)
}
}
I able to Successully connected to (SSE) server by when i emit from server side, i am not able to get from client side
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Create blank nextjs project and install express and express-sse
in the server.js Create sse endpoint
var SSE = require('express-sse');
var sse = new SSE(["array", "containing", "initial", "content", "(optional)"]);
nxt.prepare()
.then(() => {
app.get('/stream', sse.init);
})
and in index.js (Client)
componentDidMount() {
this.source = new EventSource('/stream')
this.source.onmessage = function(e) {
console.log(e)
}
}
Expected behavior
i added console.log it was not printing, i am hitting from the server
System information
- OS: Windows
- Chrome, Firefox
- Version of Next.js: 7.0.2
ceefour
Metadata
Metadata
Assignees
Labels
No labels