-
Notifications
You must be signed in to change notification settings - Fork 430
Open
Labels
Description


try {
this.ws = TauriWebSocket.connect(this.addr);
(this.ws as Promise<TauriWebSocket>).then((ws) => {
setTimeout(() => {
if (this._onOpen) {
alert("opened")
this._onOpen();
}
}, 500);
const unListener= ws.addListener((message) => {
alert(
`message type: ${message.type} content: ${message.data} ${message}`
);
if (message.type === 'Close') {
if (this._onClose) {
this._onClose(message.data as CloseEvent);
unListener()
}
}
});
});
} catch (e: any) {
alert('exception:' + e.message);
if (this._onClose) {
this._onClose();
}
}