The WebSocket transport connection timeout does not trigger a reconnection attempt
See original GitHub issueDescribe 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:
- 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:
- Created 4 years ago
- Reactions:2
- Comments:7
Top 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 >
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 Free
Top 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
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…
onConnect
andonDisconnect
(which should be used in lieu of the legacy Transport events)disconnect()
on a Transport instance before an outstanding call toconnect()
completes in which caseconnect()
will reject.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.
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.