alpacon
Websh

Websh

Websh connection

TBF

Websh session sharing (Multi-User)

Websh sessions can be shared to third parties via sharing API. After a user opens a terminal to a server, we open a Websh session and the user becomes the session owner. The session owner can invite someone else to the session to work together.

The invitee can 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: For read-only sessions, the invitee cannot type any characters to 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 the existing Alpacon API, Alpacon allows users who are not logged in to participate in shell sharing. Hence, requests can be made without including a token in the header

  • shared_url: Invitees who have received the shared URL will participate in the session sharing by accessing the provided URL

    • REACT_URL/websh/join?=session<session_id>/
  • password : Returns a one-time password to enter the shared session

    • The invitee should enter this password to participate in the session sharing

Entering the shared session

Users who receive the shared_url request access

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 : When sharing a session, only the master user has the capability to terminate the session.

This ensures that when a non-master user leaves the session, the shared session remains intact.

  • Invitees participating in 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 this action will automatically terminate the sessions of other invitees.

  • When an invitee leaves the session: Existing users can continue to use the session as usual (the session remains active).