Payloads sent to & from Leap Edge
field | type | description |
---|---|---|
op | integer | opcode |
d | object | message data |
d
(data)
field.
1
rx
Payload received from Leap Edge when connecting. This payload contains
information needed for the client to set up and maintain a connection to Leap
Edge.
field | type | description |
---|---|---|
heartbeat_interval | integer | the interval in milliseconds which the client should send heartbeat packets at |
2
tx
Client should send this after receiving Opcode 1: Hello. This should contain
identifying information about the client, including the LE token.
field | type | description |
---|---|---|
project_id | string | the project id |
token | string | the leap_token_xxx token |
3
both
Client should send this every x milliseconds, a repeating interval defined in
Opcode 1: Hello (heartbeat_interval). The repeating payload does not need a data
field, however, the socket may send this opcode with a tag
field to the
client - if this is received, the client needs to immediately send this opcode
back with the tag
field in the data object.
field | type | description |
---|---|---|
tag | ?string | the heartbeat tag |
4
rx
Client will receive this opcode when any heartbeat is sent. If client was
responding to a tagged heartbeat, then the tag
field and an extra latency
field will be included in the heartbeat acknowledgement.
field | type | description |
---|---|---|
tag | ?string | the heartbeat tag |
latency | ?integer | total round trip time |
0
both
field | type | description |
---|---|---|
c | ?string* | channel id |
u | ?bool** | whether this is a unicast message (only sent to this connection, not the entire session) |
e | string | dispatch event code |
d | object | event data |
INIT
payload will contain a null
channel IDs
(service identifier) field with the relevant service ID.
INIT
: InitializationINIT
receive
When successfully authenticating with the socket, you will receive this payload
which details your authorization scope, token metadata, as well as channels the
token is already subcribed to.
field | type | description |
---|---|---|
cid | string | connection id |
connection_count | integer | how many times this leap token is connected to the Channels service |
metadata | ?object | token metadata, if applicable |
scope | string | one of project or token |
channels | channel[] | list of subscribed channels |
SUBSCRIBE
: Create Channel subscriptionSUBSCRIBE
send
Subscribe to the specified channel. If you do not have permission to subscribe
to the specified channel, then you will receive an UNAVAILABLE
event with a
NOT_GRANTED
error code.
d
(event data) can be null
AVAILABLE
: Channel Became AvailableAVAILABLE
receive
A channel has become available to this Leap session.
field | type | description |
---|---|---|
channel | channel | the channel object |
PIPE_ROOM_AVAILABLE
: Pipe Room Became AvailablePIPE_ROOM_AVAILABLE
receive
A Pipe room has become available to this Leap session.
field | type | description |
---|---|---|
pipe_room | pipe_room | the pipe room object, with sensitive fields stripped |
connection | ?ConnectionMap* | map connection objects, documented below |
offline
(pipe_room:state)
PIPE_ROOM_UPDATE
: Pipe Room UpdatedPIPE_ROOM_UPDATE
receive
A Pipe room has updated. The data field will contain the same data type as
PIPE_ROOM_AVAILABLE
UNAVAILABLE
: Service (Channel or Pipe Room) Became UnavailableUNAVAILABLE
receive
field | type | description |
---|---|---|
graceful | boolean | if the service was expected to become unavailable |
error_code | ?string | the error identifier |
STATE_UPDATE
: Channel State was UpdatedSTATE_UPDATE
receive
field | type | description |
---|---|---|
state | object | the new state object |
MESSAGE
: Channel Message ReceivedMESSAGE
receive
field | type | description |
---|---|---|
e | string | user-provided event name |
d | object | user-provided event data |
DIRECT_MESSAGE
: Direct Message ReceivedMESSAGE
, however received when sending direct messages to
tokens rather than channels.
UNAVAILABLE
event will be sent down. If the service became
unavailable erroneously, an error_code
string will be part of the event data.
This section documents what those error codes mean.
NOT_GRANTED
UNKNOWN