~ev/wiredove-chat

98a510034e8e8173cb912ab44aed4042c8a77b6e — Ev Bogue 1 year, 12 days ago e65ea61 master
add connection messages
1 files changed, 7 insertions(+), 4 deletions(-)

M server.js
M server.js => server.js +7 -4
@@ 13,6 13,7 @@ function blast(msg, key) {
      try {
        peer.send(boxed)
      } catch (err) {
        console.log(err)
      }
    })
  } 


@@ 45,6 46,9 @@ async function handleWs(ws) {
              ws.send(boxed)
            })
          })
          publish({'text': ws.pubkey.substring(0, 10) + ' connected.'}, key).then(bog => {
            blast(bog, key)
          })
        }
      } else if (msg instanceof Uint8Array) {
        unbox(msg, key).then(unboxed => {


@@ 55,10 59,9 @@ async function handleWs(ws) {
          blast(unboxed, key)
        })
      } else if (isWebSocketCloseEvent(msg)) {
      peers.delete(id);
      dispatch(`Closed: [${id}]`);
      break;
    }
        peers.delete(id);
        break;
      } 
    } 
  } catch (err) {
    if (!ws.isClosed) {