Node.js and Server Sent Events

0

I had a problem with SSE as soon as I deployed my app on Heroku.

In the logs for the SSE there was this error:

Error: 500 RangeError: msecs must be a non-negative finite number
GET /live/redis 500 102.270 ms - -

In my route controller for /live/redis the first line was:

// let request last as long as possible
req.socket.setTimeout(Infinite);

I just copied it following a guide on the web but it was causing that error. So I changed it with this:

// let request last as long as possible
req.socket.setTimeout(0x7FFFFFFF);

Now it is working as expected but my question is: is it the correct way to solve this issue? There is a better parameter to pass in the setTimeout to be like Infinite?

javascript
node.js
server-sent-events
asked on Stack Overflow Aug 10, 2015 by Ayeye Brazo

1 Answer

-1

May be you could try Number.MAX_VALUE instead, It works for me.

answered on Stack Overflow Oct 16, 2017 by lum

User contributions licensed under CC BY-SA 3.0