Skip to main content
The ws global is your script’s access to the realtime channel — the same channel devices use.

Platform-routed messaging

Use these for normal device communication. The platform routes by target ID.
ws.send / ws.onMessage are the right tools for talking to devices — they go through the platform’s realtime routing, so you only need the target ID.

Connecting to your own server

For advanced cases, a script can open a connection to your own external WebSocket server (not the platform’s). Pass the URL you control:
connect / sendTo / disconnect are for external servers you operate. Don’t use them to reach platform internals — use ws.send / ws.onMessage for device communication.

Next: storage

Persist small values on the client.