Coder Social home page Coder Social logo

Comments (7)

iceboy233 avatar iceboy233 commented on June 13, 2024 1

The 5 seconds timeout was taken from nodejs disconnect_delay:
b0d7d17#diff-c4ae142f5c8b2a63ea9689afef142593

They are different parameters. nodejs disconnect_delay means interval to close the transport after client initiates the disconnect but the server does not respond (but it's also used when initiating the connection):
https://github.com/sockjs/sockjs-node/blob/4c9f3009be13962b0785138ccdf527c5abe925f6/lib/session.js

nodejs has a different heartbeat_delay for heartbeat, and it's still different from the timeout:
https://github.com/sockjs/sockjs-node/blob/4c9f3009be13962b0785138ccdf527c5abe925f6/lib/transport/websocket.js#L78

This was working fine until the heartbeat behavior silently changed:
9c29e99#diff-c4ae142f5c8b2a63ea9689afef142593R306

from sockjs.

asvetlov avatar asvetlov commented on June 13, 2024

Ooh. Very sorry for long delay.

Please make a PR.
I believe the timeout should be about 1 min.
Or heartbit should be decreased to 15 secs with 40 secs timeout.
@fafhrd91 ?

from sockjs.

fafhrd91 avatar fafhrd91 commented on June 13, 2024

i am fine

from sockjs.

asvetlov avatar asvetlov commented on June 13, 2024

Would you make a PR with the fix?

from sockjs.

iceboy233 avatar iceboy233 commented on June 13, 2024

What would be the best fix for this? Some options:

  1. Simply make timeout longer than heartbeat.
  2. Mimic nodejs client library.
  3. Separate heartbeat and timeout, make heartbeat similar to nats ping/pong.

from sockjs.

maparent avatar maparent commented on June 13, 2024

It seems to be worse than that; the call to Session._heartbeat does not seem to call Session._tick, which updates Session.expires. So the session expires at the end of timeout, irrespective of the relative value of timeout and heartbeat. We should make sure _tick is called; I would think right after the dequeue in Session._wait.

from sockjs.

jersobh avatar jersobh commented on June 13, 2024

Closing this issue since #265 is merged.

from sockjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.