Add support for websocket even over SSL and wait for websocket to be properly open before trying to ping
This commit is contained in:
parent
ac114c16df
commit
0f685c0a98
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
function Messaging(screen) {
|
function Messaging(screen) {
|
||||||
var ws = new WebSocket('ws://' + window.location.hostname + '/play/');
|
var ws = new WebSocket(window.location.origin.replace(/^http/, 'ws') + '/play/');
|
||||||
var debug = getParameters().debug;
|
var debug = getParameters().debug;
|
||||||
var doLog = debug != undefined && debug.match(/^(?:1|t(?:rue)?|v(?:rai)?)$/i);
|
var doLog = debug != undefined && debug.match(/^(?:1|t(?:rue)?|v(?:rai)?)$/i);
|
||||||
var keepAlivePeriod = 20000;
|
var keepAlivePeriod = 20000;
|
||||||
|
@ -66,9 +66,9 @@ function Messaging(screen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
ping();
|
|
||||||
addEventListener(["Pong"], ping);
|
|
||||||
ws.addEventListener('message', messageListener);
|
ws.addEventListener('message', messageListener);
|
||||||
|
ws.addEventListener('open', ping);
|
||||||
|
addEventListener(["Pong"], ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
function send(o) {
|
function send(o) {
|
||||||
|
|
Loading…
Reference in a new issue