Skip to content

Latest commit

 

History

History
101 lines (91 loc) · 4.27 KB

client-management.md

File metadata and controls

101 lines (91 loc) · 4.27 KB

Client Management

States

  • Database: the client is saved in a table containing:
    • ID (int): the unique identifier of the client
    • Secret Token (string): a secret token used for authentication
    • Information (json): the client's basic information
      • Name (string): the name of the client
      • Location (string): the location of the client
  • Online clients: a list containing all the online clients, the fields are:
    • WebSocket ID (string): the unique WebSocket Identifier
    • ID (int): the unique identifier of the clientclient's information

Events

Registration

When a new client registers to the local instance, the client is added in the database, the instance then reply with the client's secret token.

Request (client)

  • WebSocket:
    • Event (string): "client.to.instance"
    • Body (JSON):
      • Action (string): "register"
      • Parameters (JSON):
        • information (JSON): the new client's basic information

Response (Local Instance)

  • WebSocket
    • Event (string): "instace.to.client"
    • Body (JSON):
      • Action (string): "registered"
      • Parameters (JSON):
        • Token (string): the secret token used for client's authentication

image

Login

In order to be inserted into the Online clients List a client must be authenticated by the local instance. The client sends the secret token to the local instance, the local instance authenticate it and replies with the pending responses.

Request (client)

  • WebSocket: When the request comes the websocket protocol the client is added to the Online clients
    • Event (string): "client.to.instance"
    • Body (JSON):
      • Action (string): "login"
      • Parameters (JSON):
        • Token (string): the secret token received during registration

Response (Local Instance)

  • WebSocket
    • Event (string): "instace.to.client"
    • Body (JSON):
      • Action (string): "logged"
      • Parameters (JSON):
        • Queue (Array(Objects)): the client's pending responses

image

Update

A client can update its information sending the new information with the secret token.

Request (client)

  • WebSocket
    • Event (string): "client.to.instance"
    • Body (JSON):
      • Action (string): "update"
      • Parameters (JSON):
        • token (string): the secret token received during registration
        • information (JSON): the new client's basic information

Response (Local Instance)

  • WebSocket
    • Event (string): "instace.to.client"
    • Body (JSON):
      • Action (string): "updated"
      • Parameters (JSON)

image

Next

The next chapter is about the communication protocol.

Please {% github_edit_link "help improve this page" %}.