Skip to main content

Functions

Any HTTPS endpoint can be configured to receive socket messages using the Kanalo configuration file. Kanalo calls these Functions. These services can then process the incoming events, and if desired, respond using commands.

Data is sent from Kanalo to the endpoint using an HTTP PUT. The data is batched, and the body of the PUT will contain a JSON array of each individual event objects.

Structure

Each incoming event object in the array has a data property holding the message from the socket, and a socket property that holds an object containing information about the socket connection. The metadata fields in the socket property are:

  • ip: The IP address of the socket.
  • id: The socket's ID, used for addressing messages and events to it.
  • tags: An array of tags that have been applied to the socket (each is a string).
  • tenantName: The name of the tenant.
  • client: The name of the client application the socket used to connect.
  • lastHeartbeat: The time of the socket's latest heartbeat.
  • userMetadata: Metadata about the socket.
  • latency: Latency of the frontend WebSocket connection, in milliseconds.

Responses

The endpoint can respond with an array of commands for Kanalo to execute. See the commands page for which commands are available and their structure.