WebSocket API Documentation
August 23, 2021 ยท View on GitHub
Document explaining how the WebSocket API for the server is used.
This WebSocket server uses JWT for authentication, refer to REST API Login for more information.
The JWT has to be included as a bearer parameter in the URL, for example:
ws://localhost:8080/liveshare?bearer=jwttoken
All messages are expected to be formatted as JSON.
Table of Contents
LiveShare
Sends a notification to the user in the target field with the LiveShare code in the code field.
-
URL
/liveshare -
Data Params
- Required:
"code": [string]
"from": [string]
"target": [string] - Example:
{ "code": "livesharecode", "from": "student", "target": "teacher" } - Required:
-
Message sent to target
- Content:
{ "handle": "liveshare", "from": "student", "code": "livesharecode" }
Dashboard refresh
If a message is sent to this channel, sends a refresh signal to a specific teacher to indicate that there are dashboard updates available (see Get all students' exercise info). Refresh signals are automatically sent to teachers when students update their exercises in any way.
-
URL
/dashboard-refresh -
Data Params
- Required:
"teacher": [string] - Example:
{ "teacher": "johndoe" } - Required:
-
Message sent to target
- Content:
{ "handle": "refresh" }