- 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
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.
- WebSocket:
- Event (string): "client.to.instance"
- Body (JSON):
- Action (string): "register"
- Parameters (JSON):
- information (JSON): the new client's basic information
- WebSocket
- Event (string): "instace.to.client"
- Body (JSON):
- Action (string): "registered"
- Parameters (JSON):
- Token (string): the secret token used for client's authentication
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.
- 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
- WebSocket
- Event (string): "instace.to.client"
- Body (JSON):
- Action (string): "logged"
- Parameters (JSON):
- Queue (Array(Objects)): the client's pending responses
A client can update its information sending the new information with the secret token.
- 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
- WebSocket
- Event (string): "instace.to.client"
- Body (JSON):
- Action (string): "updated"
- Parameters (JSON)
The next chapter is about the communication protocol.
Please {% github_edit_link "help improve this page" %}.