Skip to content

Commit

Permalink
Check if there is connection error to websockets on workers
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgutgon committed Sep 18, 2024
1 parent 14befa2 commit 244cb83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/websockets/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ workers.on('connection', (socket) => {
console.log('DEBUG: Worker connected')

socket.on('evaluationStatus', (args) => {
console.log('DEBUG: Evaluation STATUS %s', args)
console.log('DEBUG: Evaluation STATUS %s', JSON.stringify(args))
const { workspaceId, data } = args
const workspace = buildWorkspaceRoom({ workspaceId })
web.to(workspace).emit('evaluationStatus', data)
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/websockets/workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export class WebsocketClient {
console.log('Workers connected to WebSocket server')
resolve(websockets)
})

websockets.on('connect_error', (error) => {
console.error(
'Error connecting to WebSocket server from WORKERS:',
error.message,
)
resolve(websockets)
})
})
}

Expand Down

0 comments on commit 244cb83

Please sign in to comment.