Skip to content

Connect an RFID device

This chapter is for developers connecting an RFID device to their own server. The server must authenticate each device and provide a Socket.IO endpoint that handles its events.

  1. Store each device's serial_number and password securely on your server.
  2. Expose GET /socket/token. The device calls it with HTTP Basic authentication, using its serial number as the username and its password as the password. Verify the credentials and return a short-lived token in a JSON token field.
  3. Expose a Socket.IO server at /socket.io/. Accept the token in the connection query, validate it, and associate the connection with the authenticated device serial number. Use TLS in production.
  4. Handle device:metadata with app_version after connection, and support reconnection with a fresh token when authentication expires.
  5. Implement listeners and responses for the device events described in Socket.IO events, including scan requests, stock reports, scan completion, and selection updates.

The SmartTrackerCloud backend uses a signed JWT for the token and checks the registered device identity again during the Socket.IO handshake. An ordinary WebSocket server is insufficient: the device expects the Socket.IO/Engine.IO protocol and the event contract above.

For model-specific setup and legacy JavaRFID details, consult source-archive/rfid_device_setup.md in this repository.