DERAS Protocol API
A unified WebSocket JSON communication layer for UHF RFID systems. Connect once, control everything โ readers, antennas, GPIO, and your database โ through a single, developer-friendly interface.
Introduction
DERAS Protocol solves the fragmentation problem in RFID deployments. Instead of writing custom code for each hardware vendor, DERAS provides a single, normalized WebSocket interface that works across Zebra, Chainway, and TUDI readers. Your application sends JSON events and receives JSON responses โ regardless of the underlying hardware.
Architecture
Quick Start
ws://<DERAS_IP>:3030. The DERAS Box typically runs on 192.168.2.100.{"event": "scan-rfid-on"} and listen for streamed tag results. That's it โ no SDK required.http://<DERAS_IP>:80 in your browser for the built-in monitoring interface.WebSocket Connection
All communication with DERAS Protocol happens over a persistent WebSocket connection. Establish the connection once; all commands and streaming results flow through the same channel.
ws://<DERAS_IP>:3030 // Reader Instance 1 ws://<DERAS_IP>:3031 // Reader Instance 2 ws://<DERAS_IP>:3032 // Reader Instance 3 ws://<DERAS_IP>:3033 // Reader Instance 4
const ws = new WebSocket('ws://192.168.2.100:3030'); ws.onopen = () => { console.log('Connected to DERAS Protocol'); ws.send(JSON.stringify({ "event": "scan-rfid-on" })); }; ws.onmessage = (msg) => { const data = JSON.parse(msg.data); console.log('DERAS event:', data.event, data); }; ws.onclose = () => console.log('Disconnected'); ws.onerror = (err) => console.error('WS Error', err);
RFID Scanning Operations
Instructs the reader to begin continuously scanning for UHF RFID tags. DERAS will stream tag events as they are detected.
{ "event": "scan-rfid-on" }
{ "event": "response-scan-rfid-on", "statusCode": 1, "message": "success" }
{ "event": "scan-rfid-result", "type": 1, "data": "64D99DF0FECABE275F89B617A7D44606", // EPC "data_tid": "E28011702000005672D20B5B", // TID "pc": null, "user": "", "ant": "1", // Antenna number "rssi": "-50,7.0", // Signal strength "sensor": null, "rfid_valid": "1" }
| Field | Type | Description |
|---|---|---|
| data | string | EPC (Electronic Product Code) of the tag |
| data_tid | string | TID (Tag Identifier) โ unique factory-written ID |
| ant | string | Antenna port number that detected the tag |
| rssi | string | Received signal strength indicator |
| rfid_valid | string | "1" = valid read, "0" = invalid |
Stops the active RFID scan session. No more tag events will be streamed until scanning is re-enabled.
{ "event": "scan-rfid-off" }
{ "event": "response-scan-rfid-off", "statusCode": 1, "message": "success" }
Performs a lightweight scan that reads TID only, without full EPC decoding. Useful for quick tag presence detection.
{ "event": "scan-rfid-light-on" }
Reader & Antenna Control
Adjusts the antenna transmission power of the reader. Higher values increase read range but may cause interference.
{ "event": "set-rfid-power", "value": 28 }
| Field | Type | Required | Description |
|---|---|---|---|
| value | number | required | Power level in dBm. Typical range: 5โ30 dBm |
{ "event": "response-set-rfid-power", "statusCode": 1, "message": "success" }
{ "event": "get-rfid-power" }
{ "event": "response-get-rfid-power", "statusCode": 1, "value": 28 }
{ "event": "set-antenna", "antenna": [1, 2] // Array of antenna port numbers to enable }
{ "event": "get-antenna-status" }
GPIO & Peripheral Control
Control external devices such as buzzers, indicator lights, or alarm systems connected to the reader's GPIO pins.
{ "event": "set-gpio-on", "pin": 1 // GPIO pin number }
{ "event": "set-gpio-off", "pin": 1 }
Database Operations
CRUD-style events for managing tag data in DERAS' local SQLite database. No custom SQL or external SDK required โ everything goes through the same WebSocket channel.
{ "event": "db-storage-get-rfid-list" }
{ "event": "response-db-storage-get-rfid-list", "statusCode": 1, "data": [ { "tid": "E28011702000014B772D70B5B", "status": 1, "category": 0, "description": "BOX A", "flag_alarm": 0 } ] }
Inserts one or multiple RFID tag records into local storage. Use the bulk variant for batch operations.
{ "event": "db-storage-insert-rfid-list-bulk", "value": [ { "tid": "E28011702000014B772D70B5B", "status": 1, "category": 0, "description": "BOX A", "flag_alarm": 0 }, { "tid": "E28011702000012EEE06C0B4BFD9001220D0A", "status": 1, "category": 0, "description": "BOX B", "flag_alarm": 1 } ] }
| Field | Type | Description |
|---|---|---|
| tid | string | Tag TID โ unique hardware identifier |
| status | number | 1 = active, 0 = inactive |
| category | number | Custom category code for your business logic |
| description | string | Human-readable label (e.g., SKU, item name) |
| flag_alarm | number | 1 = triggers alarm on detection, 0 = normal |
{ "event": "response-db-storage-insert-rfid-list-bulk", "statusCode": 1, "message": "success" }
{ "event": "db-storage-update-rfid-list", "value": { "tid": "E28011702000014B772D70B5B", "description": "BOX A - Updated", "flag_alarm": 0 } }
{ "event": "db-storage-remove-rfid-list", "tid": "E28011702000014B772D70B5B" }
Services & Reporting
Built-in operational services that activate pre-built DERAS modules โ no additional middleware required.
Activates the LACAK track-and-trace module. DERAS begins recording tag movement history and zone transitions.
{ "event": "service-api-start-track" }
Enables the AMAN loss prevention service. DERAS will monitor scanned tags against the database and trigger GPIO alarms for items marked with flag_alarm: 1.
{ "event": "service-api-start-loss-prevention" }
flag_alarm: 1 are registered in the database before activating this service.Fetches historical scan and event logs stored locally on the DERAS Box's SQLite database.
{ "event": "report-logs" }
{ "event": "response-report-logs", "statusCode": 1, "data": [ /* array of log entries */ ] }
Common Network Topology
- Runs DERAS Protocol (port 3030)
- Hosts Master Database & WebApp
- Connects reader via TCP/IP or USB
- WebApp: http://192.168.2.100:80
- Runs DERAS Protocol (port 3030)
- Connects to Master DB via WebSocket
- Accesses WebApp at 192.168.2.100
- Runs DERAS APK (localhost:3030)
- Connects to reader via Bluetooth
- Syncs to Master DB via WebSocket
- Fixed UHF readers with 2โ4 antennas
- Connect via TCP/IP to DERAS Box
- Brands: Zebra, Chainway, TUDI