Add some logging around the users and chat.

This commit is contained in:
Dave Smith-Hayes 2024-10-27 22:52:07 -04:00
parent f6947f32f1
commit 8b55e01bfa

View File

@ -14,8 +14,7 @@ const { upgradeWebSocket, websocket } = createBunWebSocket<ServerWebSocket>();
app.get("/chat-service", upgradeWebSocket((c) => { app.get("/chat-service", upgradeWebSocket((c) => {
return { return {
onOpen(event, ws) { onOpen(event, ws) {
console.log(ws); console.log(`Connection established from ${ws.raw.remoteAddress}`);
console.log(`Connection established ${event}`);
chatRoom.addListener('message-added', async function (e) { chatRoom.addListener('message-added', async function (e) {
const message = JSON.stringify({ const message = JSON.stringify({