{"id":48773,"library":"node-red-contrib-websocket-server","title":"Node-RED: WebSocket Server Nodes","description":"Provides Node-RED nodes for running a WebSocket server with open/close event information. Version 0.0.9 wraps the built-in Node-RED WebSocket node and adds extra features: configurable ping/pong behavior (send ping, receive ping with timeout), ability to target specific clients via msg._session, and a dedicated node for connection open/close events. It is maintained on GitHub but has low release cadence. Key differentiators vs built-in: explicit control over ping, session-based messaging, and event nodes.","status":"active","version":"0.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/peterko18/node-red-contrib-websocket-server","tags":["javascript","websocket","open/close","server","node-red"],"install":[{"cmd":"npm install node-red-contrib-websocket-server","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-contrib-websocket-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-contrib-websocket-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runs as a Node-RED plugin; requires Node-RED runtime.","package":"node-red","optional":false}],"imports":[{"note":"This is a Node-RED plugin, not imported in JavaScript code; add via manage palette or npm install.","symbol":"Websocket_server","correct":"Install as a Node-RED node; appears in palette after npm install."},{"note":"To target specific clients, use msg._session. Not msg.session. Case-sensitive underscore.","wrong":"msg.session = ... or msg.clientId = ...","symbol":"msg._session","correct":"msg._session = 'client_id' or array of IDs"},{"note":"Output from Websocket_Open/Close node; event field indicates connection status.","symbol":"msg.event","correct":"msg.event === 'open' or 'close'"}],"quickstart":{"code":"/**\n * Quickstart after installing node-red-contrib-websocket-server in ~/.node-red:\n * Restart Node-RED. Drag a Websocket_server node onto the canvas.\n * Set Path to '/ws' and Ping action to 'none'.\n * Deploy. Connect a Websocket_in node to the same path '/ws'.\n * Use an inject node with payload to send via Websocket_out.\n * Use a debug node on Websocket_in to see received messages.\n */\n// Example flow JSON (copy to clipboard and import in Node-RED):\n[{\"id\":\"n1\",\"type\":\"websocket-server\",\"path\":\"/ws\",\"ping-action\":\"none\"},{\"id\":\"n2\",\"type\":\"websocket-in\",\"path\":\"/ws\"},{\"id\":\"n3\",\"type\":\"websocket-out\",\"path\":\"/ws\"},{\"id\":\"n4\",\"type\":\"inject\",\"payload\":\"Hello\",\"target\":\"n3\"},{\"id\":\"n5\",\"type\":\"debug\",\"target\":\"n2\"}]","lang":"json","description":"Creates a basic WebSocket server node and client nodes for send/receive."},"warnings":[{"fix":"Use a clean path like '/ws' or '/my-websocket'.","message":"Path must not contain spaces or special characters: only use alphanumeric, hyphens, underscores.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set 'Send ping interval' to a positive number (e.g., 30).","message":"When using 'Send ping' option, the interval must be greater than 0. Otherwise pings are not sent.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use msg._session = {id: 'client123'} or msg._session = ['client1', 'client2'].","message":"msg._session must contain an id property or an array of ids. Sending a string directly may not work as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure input has property _session with an id (e.g., msg._session = {id: 'abc'}).","message":"The Websocket_Drop node requires msg._session.id; missing or incorrect format will not close the connection.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.9':22 'abil':46 'add':34 'base':83 'behavior':39 'built':26,75 'built-in':25,74 'cadenc':70 'client':50 'configur':37 'connect':58 'control':78 'dedic':55 'differenti':72 'event':19,60,86 'explicit':77 'extra':35 'featur':36 'github':65 'inform':20 'javascript':88 'key':71 'low':68 'maintain':63 'messag':84 'msg._session':52 'node':2,6,9,11,29,32,56,87,93 'node-r':1,8,28,92 'open/close':18,59,90 'ping':41,43,80 'ping/pong':38 'provid':7 'receiv':42 'red':3,10,30,94 'releas':69 'run':13 'send':40 'server':5,16,91 'session':82 'session-bas':81 'specif':49 'target':48 'timeout':45 'version':21 'via':51 'vs':73 'websocket':4,15,31,89 'wrap':23","created_at":"2026-06-07T16:58:23.677360+00:00","updated_at":"2026-06-07T16:58:23.677360+00:00","problems":[{"fix":"Run 'npm install node-red-contrib-websocket-server' inside ~/.node-red (or your Node-RED userDir).","cause":"Package not installed in the correct Node-RED user directory.","error":"Error: Cannot find module 'node-red-contrib-websocket-server'"},{"fix":"Set msg._session to an object with an id property, e.g., msg._session = {id: 'someClientId'}.","cause":"msg._session is missing or malformed.","error":"TypeError: Cannot read properties of undefined (reading 'id')"},{"fix":"Ensure Node-RED is running on the expected host and port, and the path matches exactly (case-sensitive).","cause":"Node-RED not running or wrong port/path.","error":"WebSocket connection to 'ws://...' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/peterko18/node-red-contrib-websocket-server#readme","github":"https://github.com/peterko18/node-red-contrib-websocket-server","docs":null,"changelog":null,"pypi":null,"npm":"node-red-contrib-websocket-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}