Gateway
← Back to atech.dev
Real-time WebSocket bridge for Atech boards. Stream sensor data, button presses, and state changes from your hardware to any client.
Fastest way to get started — copy this prompt to any LLM (ChatGPT, Claude) or paste straight into Lovable to generate a working app.
I have an Atech IoT device streaming over WebSocket. WebSocket URL: wss://gateway.atech.dev/ws/live/your-project-id RECEIVE messages: {"type":"device_event","payload":{"key":"temperature","value":"23.5"}} {"type":"device_connected"}, {"type":"device_disconnected"} SEND commands via WebSocket: {"type":"send_to_device","device_id":"your-project-id","payload":{"action":"set_color","value":"FF4500"}} Or via HTTP POST to https://gateway.atech.dev/send/your-project-id with body {"action":"set_color","value":"FF4500"} All commands follow {"action":"...","value":"..."} format.
Open a WebSocket connection to this URL from any app to start streaming. Replace your-project-id with your project's UUID.
wss://gateway.atech.dev/ws/live/your-project-id
Once connected, the gateway pushes JSON messages to your app whenever something happens on the device. The main message is device_event — it carries sensor readings, button presses, or any value the board reports. key is the name (e.g. temperature) and value is the reading. You'll also receive lifecycle events when the device comes online or goes offline.
{"type": "device_event", "payload": {"key": "temperature", "value": "23.5"}}
{"type": "device_connected"}
{"type": "device_disconnected"}
To control the device from your app, send a JSON message via the same WebSocket or via HTTP POST. The payload is forwarded directly to the board. Use any structure your firmware expects — typically {"action": "...", "value": "..."}.
curl -X POST https://gateway.atech.dev/send/your-project-id -d '{"action": "set_color", "value": "FF4500"}'
A minimal browser example — connects to the gateway and logs every message the device sends.
const ws = new WebSocket( "wss://gateway.atech.dev/ws/live/your-project-id" ); ws.onmessage = (e) => console.log(JSON.parse(e.data));
Requires pip install websockets. Connects to the gateway, prints every message, and sends a sample command.
import asyncio, json, websockets URL = "wss://gateway.atech.dev/ws/live/your-project-id" async def main(): async with websockets.connect(URL) as ws: # Send a command to the device await ws.send(json.dumps({ "type": "send_to_device", "device_id": "your-project-id", "payload": {"action": "set_color", "value": "FF4500"} })) # Stream incoming events async for raw in ws: print(json.loads(raw)) asyncio.run(main())