Connect

Message to authenticate and negotiate connection parameters.

Request

A Connect message MUST be sent from the client to the server to authenticate and negotiate the connection parameters. This message MUST be the first one after establishing the connection. If any other message or data is received, the server MUST close the connection immediately.

Field
Value
Description

Message Type

0x03

Connect

Message Size

Remaining Message Length

Body

Name
Field
Type
Mandatory
Description

Stream Id

0x01

varint

Parameters

0x02

any

Connect parameters, that can be used to identify the authentication type.

Payload

0x03

any

Authentication payload to log-in with the server.

Parameters

Key
Type
Default
Description

"pv"

number

0

Protocol Version

0: Legacy PSON encoding

1: New PSON encoding (more efficient)

"ka"

number

60

Keep-Alive Interval

Heartbeat interval in seconds (max: 1800)

Server applies 15% margin for timeout detection

"at"

number

0

Authentication Type

0: Credentials (username/device/password)

Future:

1 (Auto-provision),

2 (Token), etc.

"ct"

string

-

Client Type (future)

Platform identifier: "arduino", "esp32", "raspberry", etc.

"fw"

string

-

Firmware Version (future)

Client firmware version for compatibility checks

Example PARAMETERS

{
    "pv": 1, // Use new PSON protocol
    "ka": 120, // 2-minute keep-alive
    "at": 0 // Credentials authentication
}

Payload

The PAYLOAD field format depends on the authentication type ("at" parameter).

Authentication Type 0: Credentials (Default)

When "at": 0 or not specified, PAYLOAD must be a JSON array with exactly 3 elements:

["username", "device_id", "password"]

Credentials

Index
Type
Description

0

string

Account username

1

string

Device identifier

2

string

Device password/token

Response

Last updated

Was this helpful?