Skip to content

1. Setting up a Connection

Florian König edited this page Oct 31, 2022 · 7 revisions

To connect two clients (host and attendee):

Appoint Client as Host: connect-host

To determine yourself as host, send this message to the server:

{
  "type": "connect-host"
}

You will get a reply containing your id and reconnect code:

{
  "type": "connected-id",
  "id": "$hostId",
  "reconnectCode": "$reconnectCode"
}

Request to Connect the Attendee: connect-attendee

Use the hostId to request connecting with the other client. code will be sent to the host client to verify the request.

{
  "type": "connect-attendee", 
  "host": "$hostId",
  "code": "$code"
}

Once the host has accepted the request, the server will emit your id:

{
  "type": "connected-id",
  "id": "$clientId",
  "reconnectCode": "$reconnectCode"
}

Accept or decline a connection request

Whenever an attendee client requests a connection, the host will get this message asking for approval:

{
  "type": "verify-attendee-request",
  "clientId": "$clientId",
  "code": "$code"
}

If you deem the provided code worthy, accept the request: json { "type": "accept-attendee-request", "clientId": "$clientId" } Otherwise, decline the request: json { "type": "decline-attendee-request", "clientId": "$CLIENT" }

Clone this wiki locally