Skip to main content
The Melody device can request an OTP directly over its active WebSocket connection to the Haptics server. This is an alternative to the WiFi API startOtp service command and does not require a separate HTTP call.

Frame Types


Message Definitions

OTPRequest (device → server):
OTPResponse (server → device):

Flow

  1. Device sends an OTP_REQUEST frame with a serialized (empty) OTPRequest message over the existing WebSocket connection.
  2. Server generates the OTP and replies with an OTP_RESPONSE frame on the same connection.
  3. If generation fails, error is non-empty — otp should be ignored in this case.

Code Example


Notes

  • The OTP is scoped to the requesting device’s connection — it is not broadcast to other subscribers.
  • Maximum response time is 10 seconds (proxy timeout to the session manager).
  • The startOtp WiFi API service command remains available as an alternative for devices that need OTP without an active WebSocket connection.