meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.15k stars 2.47k forks source link

JS library sometimes gets 'stuck' connecting with Websockets #208

Closed mattvv closed 9 years ago

mattvv commented 9 years ago

Hey guys,

Having an issue with the javascript library where every so often connecting to the server doesn't seem to connect at all. Refreshing the page will cause a good connection, but obviously this is not an ideal experience for the user.

Turning off Websockets solves this.

Steps to reproduce:

  1. Try and have janus connect to a server using websockets.
  2. If connection is successful, refresh page and try again

Observed Results: 1/3 connections will get stuck trying to connect

Expected Results: The JS library either successfully connects or falls back to the next server in the chain.

Here's the debug logs from chrome:

Library initialized: true
janus.js:106 Multiple servers provided (3), will use the first that works
janus.js:109 ["wss://switch.redacted.com:8989/janus", "https://switch.redacted.com/janus", "http://switch.redacted.com:8088/janus"]
janus.js:320 Server #1: trying WebSockets to contact Janus
janus.js:325 wss://switch.redacted.com:8989/janus

Janus side logs:

[2703541935] Adding event to queue of messages...
[2703541935] Handle detached (error=0), scheduling destruction
Thread pool, serving request
[WSS-0xeb2a80] WS connection closed
[WSS-0xeb2a80] Destroying WebSocket client
[WSS-0xeb2a80]   -- closed
AudioBridge Participant thread leaving...
Last user just left room 15, going idle...
[WSS-0xeb2a80] 19 (LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION)
[WSS-0xeb2a80] WebSocket connection accepted
[WSS-0xeb2a80]   -- Ready to be used!
[WSS-0xeb2a80] Got 47 bytes:
Thread pool, serving request
Cleaning up session 2441012932...
Destroying session 2441012932
Cleaning up handle 2703541935...
[2703541935] WebRTC resources freed
[2703541935] Handle and related resources freed
Freeing old AudioBridge session

I'm using 7a8da8c67ddba8fffbdc6272f9f22bf606ecaf10

lminiero commented 9 years ago

I can't replicate this. I had a different issue, where some messages were not notified until a subsequent WebSocket request (e.g., a keepalive) "unlocked" them, but I just fixed that in https://github.com/meetecho/janus-gateway/commit/8a7df51e0056f30dae1a4a99a7f3cbb79d08aeca

mattvv commented 9 years ago

Thanks! I'll see if I can reproduce with this version.

mattvv commented 9 years ago

This appears fixed in 8a7df51

Thanks @lminiero