Skip to content

Commit b00ea46

Browse files
committed
add websocket error handler
1 parent a77030b commit b00ea46

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/server/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { parse } from 'node:url';
12
import { Connect, Identity, Inboxes, Messages, SpaceEvents, Utils } from '@graphprotocol/hypergraph';
23
import { bytesToHex, randomBytes } from '@noble/hashes/utils.js';
34
import cors from 'cors';
45
import { Effect, Exit, Schema } from 'effect';
56
import express, { type Request, type Response } from 'express';
6-
import { parse } from 'node:url';
77
import WebSocket, { WebSocketServer } from 'ws';
88
import { addAppIdentityToSpaces } from './handlers/add-app-identity-to-spaces.js';
99
import { applySpaceEvent } from './handlers/applySpaceEvent.js';
@@ -722,6 +722,10 @@ webSocketServer.on('connection', async (webSocket: CustomWebSocket, request: Req
722722
console.log('Account Address:', accountAddress);
723723
webSocket.subscribedSpaces = new Set();
724724

725+
webSocket.on('error', (error) => {
726+
console.error('WebSocket error:', error);
727+
});
728+
725729
console.log('Connection established', accountAddress);
726730
webSocket.on('message', async (message) => {
727731
try {

0 commit comments

Comments
 (0)