close relay's websocket only if it's in state OPEN

This commit is contained in:
ramigs
2023-03-04 14:59:33 +00:00
committed by fiatjaf_
parent 01435ab9f5
commit 82228036ef

View File

@@ -310,8 +310,9 @@ export function relayInit(
listeners = {connect: [], disconnect: [], error: [], notice: []}
subListeners = {}
pubListeners = {}
if (ws.readyState === WebSocket.OPEN) {
ws?.close()
}
},
get status() {
return ws?.readyState ?? 3