-
Notifications
You must be signed in to change notification settings - Fork 2
Socket Server Documentation
joe edited this page Mar 16, 2018
·
3 revisions
For token authentication the secret key is located in the JS Object in config.js in the root directory
DON'T FORGET TO CHANGE THIS VALUE IN PRODUCTION.
When establishing a WebSocket connection, one must put the token as a token query param. e.g.
wss://sasc-help.com/socket?token=<TOKEN_VALUE>
The token should be a JWT token with the following payload data and JSON structure:
{
"type": "COUNSELOR",
"name": "Joe"
}This will be subject to change after we add in the SMS features.
The following events will have listeners after the connection takes place. These are to be sent by the client when they're a student.
- Description: This will be the main end point called to when a student sends a message. Simply put the message string as the other emit parameter.
- Payload:
"<MSG_STRING>"
The following events will have listeners after the connection takes place. These are to be sent by the client when they're a counselor.
- Description: This will be the main end point called to when the counselor sends a message. Simply put the JS Object as the other emit parameter.
- Payload:
{
"convoId": "<UUID>",
"msg": "<MSG_STRING>"
}