Небольшие поправки
This commit is contained in:
@@ -52,12 +52,13 @@ class WebSocketConnection {
|
|||||||
return this.listeners.length != len;
|
return this.listeners.length != len;
|
||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
open(url) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (this.ws && this.ws.readyState == WebSocket.OPEN) {
|
if (this.ws && this.ws.readyState == WebSocket.OPEN) {
|
||||||
resolve(this.ws);
|
resolve(this.ws);
|
||||||
} else {
|
} else {
|
||||||
this.ws = new WebSocket(`ws://${window.location.host}`);
|
url = url || `ws://${window.location.host}/ws`;
|
||||||
|
this.ws = new WebSocket(url);
|
||||||
|
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class Reader {
|
|||||||
return response;
|
return response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//с WebSocket проблема, проверяем по http
|
//с WebSocket проблема, проверяем по http
|
||||||
|
|||||||
Reference in New Issue
Block a user