MCPcopy Create free account
hub / github.com/vercel/examples / close

Function close

websockets/nuxt/server/api/ws.ts:69–74  ·  view source on GitHub ↗
(peer)

Source from the content-addressed store, hash-verified

67 }
68 },
69 close(peer) {
70 const identity = peer.context.identity as Peer | undefined
71 if (!identity) return
72 peers.delete(identity.id)
73 peer.publish(CHANNEL, JSON.stringify({ t: 'leave', id: identity.id } satisfies ServerMessage))
74 },
75 error(peer, error) {
76 console.error('[realtime] ws error', peer.id, error)
77 const identity = peer.context.identity as Peer | undefined

Callers

nothing calls this directly

Calls 1

publishMethod · 0.80

Tested by

no test coverage detected