This commit is contained in:
Kevin Jahns 2023-03-02 17:08:56 +01:00
parent d22aecca7f
commit 0b5279fd33

View File

@ -203,7 +203,6 @@ const setupWS = (provider) => {
websocket.send(encoding.toUint8Array(encoderAwarenessState))
}
}
provider.emit('status', [{
status: 'connecting'
}])
@ -215,8 +214,9 @@ const setupWS = (provider) => {
* @param {ArrayBuffer} buf
*/
const broadcastMessage = (provider, buf) => {
if (provider.wsconnected && provider.ws && provider.ws.readyState === provider.ws.OPEN) {
/** @type {WebSocket} */ (provider.ws).send(buf)
const ws = provider.ws
if (provider.wsconnected && ws && ws.readyState === ws.OPEN) {
ws.send(buf)
}
if (provider.bcconnected) {
bc.publish(provider.bcChannel, buf, provider)