View Source ExAzureSpeech.Common.SocketMessage (ex_azure_speech v0.1.0)

Represents a message to be sent through the WebSocket.

Summary

Types

t()

id: Non-Dashered GUID for the message.
payload:The message payload, it can be a binary or a text.
message_type: The type of the message.
headers: List of headers for the message.

Functions

Deserializes a text message into a SocketMessage.

Serializers a SocketMessage to the expected websocket format.

Types

@type t() :: %ExAzureSpeech.Common.SocketMessage{
  headers: [{String.t(), String.t()}],
  id: ExAzureSpeech.Common.Guid.t() | nil,
  message_type: ExAzureSpeech.Common.Messages.MessageType.t(),
  payload: binary()
}

id: Non-Dashered GUID for the message.
payload:The message payload, it can be a binary or a text.
message_type: The type of the message.
headers: List of headers for the message.

Functions

@spec deserialize(:text, binary()) :: t()

Deserializes a text message into a SocketMessage.

Link to this function

serialize(socket_message)

View Source
@spec serialize(t()) :: binary() | iodata()

Serializers a SocketMessage to the expected websocket format.

Text messages are serialized as headers followed by a double line break and the payload.
Binary messages are serialized as a 16-bit big-endian integer representing the length of the headers, followed by the headers and the payload.