Node.js - websocket.close()
Closes a connection to a websocket
import { websocket } from '@nitric/sdk'const socket = websocket('socket')/*** Close a connection to a client.** @param connectionId the client received when connecting to the websocket*/const closeConnection = async (connectionId) => {await socket.close(connectionId)}
Parameters
- Name
connectionId
- Required
- Required
- Type
- string
- Description
The ID of the connection to be closed.
Examples
Close a connection to the websocket on message
import { websocket } from '@nitric/sdk'const socket = websocket('socket')/*** Close a connection to a client.** @param connectionId the client received when connecting to the websocket*/const closeConnection = async (connectionId) => {await socket.close(connectionId)}
Last updated on Oct 11, 2024