Connection to a broker is done over WebSockets. Connection URL format is as follows:
Where:
- wss - indicates that the connection is secure
- hostname - the hostname of the broker
- port - the port number of the broker
- protocol - the protocol version of the broker
Once the connection is established, the client must send a sequence of
messages to the broker to authenticate itself. Once the broker has verified
the client's identity, the client can start sending and receiving messages.
This process is demonstrated in the following diagram:
sequenceDiagram actor Worker par Connection Initiation Worker->>+Broker: Hello Broker->>-Worker: KOSK Challenge activate Worker Worker->>Broker: KOSK Response deactivate Worker and Consumer->>+Broker: Hello Broker->>-Consumer: KOSK Challenge activate Consumer Consumer->>Broker: KOSK Response deactivate Consumer Consumer->>Broker: Subscribe end loop Send Verified Data Worker-->>Consumer: Send Data Through Broker end
Unchained Connection Initiation Sequence
The Hello message structure is as follows:
type Signer struct {
Name string
EvmWallet string
PublicKey [96]byte
ShortPublicKey [48]byte
}
type Challenge struct {
Passed bool
Random [128]byte
Signature [48]byte
}