Scanner Events
Overview
Aladdin SDS provides real-time websocket endpoints for subscribing to device events. This allows applications to receive immediate notifications when barcodes are scanned or device status changes occur.
WebSocket Endpoints
Subscribe to Barcode Events
Endpoint: ws://localhost:9000/sub_barcode
Subscribe to this websocket endpoint to receive real-time barcode scan events from connected devices.
Message Format
{
"deviceID": "12345",
"content": "ABC123",
"message": "ABC123"
}
Fields Description
| Field | Type | Description |
|---|---|---|
deviceID | string | Unique identifier of the device that scanned the barcode |
content | string | The actual barcode content that was scanned |
message | string | Human-readable message containing the barcode data |
Subscribe to Status Events
Endpoint: ws://localhost:9000/sub_status
Subscribe to this WebSocket endpoint to receive real-time device status updates, including connection status and command execution results.
Message Format
{
"deviceID": "12345",
"message": "Device connected",
"value": {
"id": "12345",
"connected": true
},
"eventType": "DEVICE_CONNECTION_STATUS"
}
Fields Description
| Field | Type | Description |
|---|---|---|
deviceID | string | Unique identifier of the device |
message | string | Human-readable status message |
value | object | Structured data containing status details |
value.id | string | Device identifier |
value.connected | boolean | Device connection status |
eventType | string | Type of status event (see Event Types below) |
Event Types
| Event Type | Description |
|---|---|
UPDATE_STATUS | General status update from the device |
DEVICE_CONNECTION_STATUS | Device connection/disconnection events |
For more detailed information about the WebSocket API specification, see the Aladdin SDS WebSocket AsyncAPI documentation.