Fixing disconnection; production buildout

This commit is contained in:
James Barnsley
2020-10-02 22:48:12 +13:00
parent 555d7e717a
commit fc2a1c9a8c
5 changed files with 28 additions and 24 deletions

View File

@ -777,8 +777,8 @@ class SnapStream {
console.info("Message not handled, type: " + type);
}
};
this.streamsocket.onopen = (ev) => {
console.log("Snapcast web streaming connected");
this.streamsocket.onopen = (e) => {
console.log('SnapStream socket opened', e);
let hello = new HelloMessage();
hello.mac = "00:00:00:00:00:00";
hello.arch = "web";
@ -789,9 +789,12 @@ class SnapStream {
this.syncTime();
this.syncHandle = window.setInterval(() => this.syncTime(), 1000);
};
this.streamsocket.onerror = (ev) => { alert("error: " + ev.type); }; //this.onError(ev);
this.streamsocket.onclose = (ev) => {
stop();
this.streamsocket.onerror = (e) => {
console.error('SnapStream socket error', e);
};
this.streamsocket.onclose = (e) => {
console.log('SnapStream socket closed', e);
this.stop();
};
// this.ageBuffer = new Array<number>();
this.timeProvider = new TimeProvider();
@ -801,7 +804,7 @@ class SnapStream {
msg.sent.setMilliseconds(this.timeProvider.now());
msg.id = ++this.msgId;
if (this.streamsocket.readyState != this.streamsocket.OPEN) {
stop();
this.stop();
}
else {
this.streamsocket.send(msg.serialize());