Get started with Node.js
Connect Node.js programs to an IOSignal server to build bots, bridges to other systems, automation scripts and virtual devices. The same iosignal package contains the server too. If you are new, read core concepts in five minutes first; tags, delivery types and the home channel are the same in every environment.
1. Install
Node.js 22.16.0 or later is required.
npm install iosignal
2. First connection
In the five-minute quickstart, run a server, a receiver and a sender in three terminals. When the message appears in the receiver's terminal, it works. Then put subscribing and sending into one program with Build a Node.js client.
3. What differs in Node.js
- Imports: import by name, as in
import { IO, Server } from 'iosignal'. This differs from the browser'siosignal/browser/esm/io.js. - The server is in the same package:
new Server({ port: 7777 })starts a server in one line. For operations, see Get started with a server. - TCP is possible too: to connect over the same TCP port as Arduino instead of WebSocket, use
IOCongSocket(cong://host:port). Client API - Process lifetime: a lost connection reconnects automatically. Call
stop()(no more reconnecting) ordestroy()so the process can exit. - Acting as a device: a Node.js program that answers
#searchand sends$name,$uiand$stateappears in remocon.kr as a device. Build a device (app.iosignal.net compatible): Node.js example
4. Build guides
| What you want to build | Pages |
|---|---|
| A bot that listens on a channel and answers | Build a Node.js client, JS subscriptions and lifecycle |
| A virtual device the web app controls | Build a device (app.iosignal.net compatible) |
| Your own server | Run a server |
| A game the server judges | Get started with games |
| Looking up methods and events | Client API |
5. Tools
For connecting and testing from a terminal without code:
- CLI client
io-client: subscribe, send and watch what arrives. - remocon CLI: send commands to devices.
- CLI server
io-server: run a server without code.
6. When you are stuck
- It does not run: install and run diagnosis
readynever arrives: connection diagnosis- Messages do not show: delivery diagnosis