Commit 2de1ce8e authored by Chunchi Che's avatar Chunchi Che

alert error msg for websocket

parent 2c209e55
...@@ -17,6 +17,13 @@ export class WebSocketStream { ...@@ -17,6 +17,13 @@ export class WebSocketStream {
if (onWsOpen) { if (onWsOpen) {
this.ws.onopen = (e) => onWsOpen(this.ws, e); this.ws.onopen = (e) => onWsOpen(this.ws, e);
} }
this.ws.onerror = (e) => {
if (e instanceof ErrorEvent) {
alert(`websocket error: ${e.message}`);
} else {
alert(`websocket connect to ${ip} error`);
}
};
const ws = this.ws; const ws = this.ws;
this.stream = new ReadableStream({ this.stream = new ReadableStream({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment