question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The WebSocket transport connection timeout does not trigger a reconnection attempt

See original GitHub issue

Describe the bug The WebSocket transport connection timeout does not trigger a reconnection attempt. The reconnection attempt is only triggered when the WebSocket itself times out (which can take a very long time, upwards of 1 minute).

Logs https://gist.github.com/yren-ITH/1f39bc32e0d115e30791366cff6ec17e

To Reproduce (if possible) Steps to reproduce the behavior:

  1. Create a UserAgent with a list of dummy wsServers and logging enabled
const userAgent = new UA({
  transportOptions: {
    wsServers: {
      `wss:example.com:11111`,
      `wss:example.net:11111`,
      `wss:example.org:11111`
    },
    connectionTimeout: 3,
    maxReconnectionAttempts: 1,
    reconnectionTimeout: 1,
  },
  uri: 'foo@bar.com',
  password: 'foobar',
  log: {
    level: 3,
  },
})

Expected behavior

  • Each connection attempt times out after three seconds.
  • One second after the connection times out, a new connection attempt is made with the next WS server in the list.

Observed behavior

  • Each connection attempt times out after three seconds.
  • One minute later, a new connection attempt is made with the next WS server in the list.

Environment Information SIP.js Version 0.14.6 Chrome Version 74.0.3729.169 (Official Build) (64-bit)

Additional context N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
john-e-riordancommented, Nov 26, 2019

The following comment does not speak to what is going on in the current API or provide anything helpful on that front.

But FYI with regard to the new API - a couple of architectural things changed as of 0.15.8…

  1. Reconnection logic has been moved to UserAgent
  2. A single Transport instance now only deals with a single WebSocket server
  3. The UserAgent delegate now provides onConnect and onDisconnect (which should be used in lieu of the legacy Transport events)
  4. One may now call disconnect() on a Transport instance before an outstanding call to connect() completes in which case connect() will reject.
  5. Support for configuring multiple servers was removed.

With all that said, I don’t see any technical roadblocks to adding multiple server back in as a feature of the UserAgent (instead of the Transport). Having UserAgent construct and maintain individual Transport instances, and manage the associated fail overs, and swapping them in/out as the Transport being used by the UserAgentCore seems like it would relatively straightforward.

I’m not planning on getting to it in the immediate term, but I’ll put it on the 0.16.x roadmap.

0reactions
james-criscuolocommented, Apr 29, 2020

This issue has been fixed since 0.15.8, and while there is more pending work for 0.16, the issue itself has been resolved, so I’ll close.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >
Websocket transport reliability (Socket.io data loss during ...
When a client tries to reconnect, send the same client ID it sent with the original connection attempt. The server will view this...
Read more >
Client API - Socket.IO 中文文档
A connection attempt following a transport error will use the normal upgrade process. It is recommended you turn this on only when using...
Read more >
API Reference — python-socketio documentation
Valid transports are 'polling' and 'websocket' . If not given, the polling transport is connected first, then an upgrade to websocket is attempted....
Read more >
Browser client - Faye: Simple pub/sub messaging for the web
If the connection to the server is lost, the client will periodically try to reconnect and redeliver dropped messages. You can control how...
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