onWebsocket()

wrtc.onWebsocket() is called when a socket object has opened or closed a websocket connection to IXNX server, or if a websocket open failed.

Some websocket fails result in wrtc.onError() event function calls instead.

You can use this event function to alert user of internet connection problems (if websocket connection fails with "FAIL-SLOW" or "FAIL-FAST", see below).

Occurs

Websocket connection to IXNX server is opened, closed or failed.

Arguments

wrtc.onWebsocket(socket, arg)

  • socket - the socket object raising the event
  • arg - string:
    • "OPEN" - websocket successfully opened
    • "CLOSE" - websocket closed intentionally
    • "FAIL-FAST" - connection failed quickly because of IXNX reporting overload or no Internet connection at all. wrtc_kit will retry automatically after 10-40 sec.
    • "FAIL-SLOW" - connection failed slowly because of Internet connection problems made open attempt time out. wrtc_kit will retry automatically.

Additional delay

A fast fail may be sign of IXNX server overload. To reduce risk of further overloading a random additional delay (of 10-40 sec) is added by wrtc_kit before it attempts to open a websocket connection again. If your server handles more than a few thousands of clients you might need to adjust this additional delay by altering the value of socket.additionalWaitBeforeNextWsOpen in your wrtc.onWebsocket() function, to make retries be delayed a random number of seconds when IXNX server reports a FAIL-FAST overload. You might for instance delay retries more while your client is idle, but make quicker retries while in a call.

This kind of additional delay is only needed for very large installations.

ixnx/wrtc/js/api/wrtc/onwebsocket.txt · Last modified: by tibor
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0