Atech Gateway ← Back to atech.dev

Welcome to Atech Gateway

Real-time WebSocket bridge for Atech boards. Stream sensor data, button presses, and state changes from your hardware to any client.

Documentation

Use with AI tools

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.
WebSocket URL

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
Receive events

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"}
Send commands

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"}'
JavaScript example

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));
Python example

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())