Currently the executing the code is done as part of the websocket connection. If the connection gets lost, there is no way to reconnect. This is an improvement over protocol v0.1 by adding the concept of sessions.
Protocol
The LiveCode manages sessions of execution. A new session is created by sending a POST request to /sessions and each session info can be get by sending a GET request to /sessions/session-id.
List all sessions of the current user
GET /sessions
--
200 OK
[
{"id": "d953d41febcc"},
{"id": "'0f55ee843aa5'"}
]
This will be implemented only after adding support for users.
Create a new session
POST /sessions
{
"runtime": "python-canvas",
"code": "circle(100, 100, 50)"
}
---
201 Created
Location: http://..../sessions/d953d41febcc
{
"id": "d953d41febcc",
"created": "2021-03-01T10:20:30",
"elapsed": 5.3,
"links": {
"self": "http://.../sessions/d953d41febcc",
"stream": "ws://.../sessions/d953d41febcc/stream"
}
}
The stream link provides the websocket connection for receiving the output and events .
Delete a session
DELETE /sessions/d953d41febcc
---
204 No Content
Possible Error codes:
Connection to the stream
GET /sessions/d953d41febcc/stream
Connection: Upgrade
Upgrade: websocket
---
101 Switching Protocols
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Accept: ...
If the connection to a websocket is lost, connection can be retried.
The behaviour of multiple websocket clients connecting at the same time is undefined.
The stream websocket protocol
The stream websocket protocol will be save as in the LiveCode protocol 0.1, except that there won't be any exec command.
Currently the executing the code is done as part of the websocket connection. If the connection gets lost, there is no way to reconnect. This is an improvement over protocol v0.1 by adding the concept of sessions.
Protocol
The LiveCode manages sessions of execution. A new session is created by sending a POST request to
/sessionsand each session info can be get by sending aGETrequest to/sessions/session-id.List all sessions of the current user
This will be implemented only after adding support for users.
Create a new session
The
streamlink provides the websocket connection for receiving the output and events .Delete a session
Possible Error codes:
Connection to the stream
If the connection to a websocket is lost, connection can be retried.
The behaviour of multiple websocket clients connecting at the same time is undefined.
The stream websocket protocol
The stream websocket protocol will be save as in the LiveCode protocol 0.1, except that there won't be any
execcommand.