Websh
Websh connection
TBD
Websh session sharing (Multi-User)
Websh sessions can be shared to third parties using the sharing API. Once a user opens a terminal to a server, a Websh session is created and the user becomes the session owner. The session owner can then others to collaborate in the same terminal session.
The invitee will use the same terminal that the session owner is working on. The invitee don't have to be a regular alpacon user.
Sharing a session
Request:
POST /api/websh/sessions/<session_id>/share/
{
"read_only" : true or false
}
only_read
: In read-only sessions, the invitee cannot input anything in the terminal.
Response:
HTTP 201 Created
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept
{
"shared_url": "http://localhost:3000/websh/join?session=c58cd93f-6c7e-4ccb-a188-b244fd6a3364",
"password": "jBCfiU2yXHoMUlDI"
}
Note : Unlike other Alpacon APIs, Alpacon allows users who are not signed in to participate in shell sharing. Hence, requests can be made without including a token in the header
-
shared_url
: The URL that invitees can use to join the shared session.REACT_URL/websh/join?=session<session_id>/
-
password
: Returns a one-time password required for the invitee to join the shared session.
Entering the shared session
Users with the shared_url can access the session by sending a request.
Request:
POST "http://localhost:3000/websh/join?session=c58cd93f-6c7e-4ccb-a188-b244fd6a3364"
- 실제 alpacon-server 에 요청해야하는 URL 형식 :
/api/websh/sessions/session_id/join/
- body : password
{
"password" : "jBCfiU2yXHoMUlDI"
}
password
: Enter the password shared by the master user.
Response:
HTTP 201 Created
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept
{
"websocket_url": "ws://localhost:8000/ws/websh/8c9e3ae3-49ee-4f72-a76e-2602da166af7/LUfDxpOchzhuJ9EHjxNgYPq7TF1Vneod/",
"server" : "test",
"read_only" : true,
"rows": 68,
"cols": 118,
}
Disconnect Sharing Session
Note : Only the session owner (master user) can terminate the shared session.
This ensures that the shared session remains intact when a non-master user leaves the session.
-
Invitees of a shared session cannot terminate the session.
-
When the master user terminates the session: The master user can terminate the session in the same way as before, and the sessions of other invitees will be automatically terminated.
-
When an invitee leaves the session: The session remains active for other users.