Skip to content

Client Connection

Tim Arnold edited this page Nov 2, 2022 · 2 revisions

In order to establish a connection from a client to the backend, you have to use a websocket. This connection can only be used from a registered user or from an appid.

For a device to server connection see Device Connection.

The current websocket path is:

/live/v1/client

The communication is event-based. So you always have to send data proactive. Every message contains a type attribute specifying the type of the event.

Client to Server Events

Register to Nearby Drone Events

Using the following event you can enable your client receiving periodic updates about nearby drones. In order to use this event the server must know your position by sending an event containing clients` position.

{
 "type": "registerGetNearbyDrones"
}

Unregister from Nearby Drone Events

Cancle subscription for nearby drones.

{
 "type": "unregisterGetNearbyDrones"
}

Register to Nearby Rekari Action

Using the following event you can enable your client receiving periodic updates about nearby rekari actions. In order to use this event the server must know your position by sending an event containing clients` position.

{
 "type": "registerGetNearbyRescues"
}

Unregister from Nearby Rekari Action Events

Cancel subscription for nearby rescues.

{
 "type": "unregisterGetNearbyRekariAction"
}

Update client position

Send client position to server. This position will never be stored on the database. You are not allowed to send wrong positions otherwise your connection will be disconnected.

{
 "type": "updateClientLocation",
 "pos": {
    "lat": YOUR_LAT,
    "long": YOUR_LONG
  }
}

Sever to Client Events

On new client connection

Send clientID to client.

{
 "type": "welcome",
 "clientID": CLIENT_ID
}

Rekari aktion user move

...