freeswitch/libs/libblade/flows/flow1.json

228 lines
5.4 KiB
JSON

--->
GET /login HTTP/1.1
Host: master.freeswitch.org
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Protocol: blade-1.0
Sec-WebSocket-Version: 13
<---
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Sec-WebSocket-Protocol: blade-1.0
---> CONNECT TO THE MASTER NODE
{
"jsonrpc": "2.0",
"method": "BLADE.connect",
"params": {
"blade": "1.0",
"session-id": "", // optional, hint to reconnect to existing session
},
"id": 1
}
<--- SUCCESS (TBD FAIL CASE)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blade": "1.0",
"connection-state": "connected",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
"realm-list": [{"realm": "ls1.mydomain.com"}]
"allowed-protocol": ["BLADE"],
}
}
---> REGISTER ADDITIONAL IDENTITY "foobar@ls1.mydomain.com/blah"
{
"jsonrpc": "2.0",
"method": "BLADE.register",
"params": {
"identity": "foobar",
"realm": "ls1.mydomain.com",
"resource": "blah",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 2
}
<--- SUCCESS (TBD FAIL CASE) messages for this foobar IDENTITY will now go to this node.
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"identity": "foobar",
"realm": "ls1.mydomain.com",
"resource": "blah",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
}
}
---> REGISTER SUBDOMAIN "myspace.ls1.mydomain.com"
{
"jsonrpc": "2.0",
"method": "BLADE.register",
"params": {
"sub-realm": "myspace",
"realm": "ls1.mydomain.com",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 3
}
<--- SUCCESS (TBD FAIL CASE) messages for any IDENTITY at "myspace.ls1.mydomain.com" will now go to this node.
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"sub-realm": "myspace",
"realm": "ls1.mydomain.com",
"realm-list": [{"realm": "ls1.mydomain.com", "sub-realms": ["myspace"]}],
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
}
}
---> PUBLISH API LSAPI "A single node must have exclusive access to the PROTOCOL's namespace with the master to publish"
// MAYBE ADD SCHEMA and method to fetch it.
{
"jsonrpc": "2.0",
"method": "BLADE.publish",
"params": {
"protocol": "LSAPI",
"exclusive": true,
"realm": "ls1.mydomain.com",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 4
}
<--- SUCCESS (TBD FAIL CASE)
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"protocol": "LSAPI",
"allowed-protocol": ["BLADE", "LSAPI"],
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
}
}
---> Locate identities holding an api
// MAYBE ADD SCHEMA and method to fetch it.
{
"jsonrpc": "2.0",
"method": "BLADE.locate",
"params": {
"protocol": "LSAPI",
"realm": "ls1.mydomain.com",
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 4.1
}
<--- SUCCESS (TBD FAIL CASE)
{
"jsonrpc": "2.0",
"id": 4.1,
"result": {
"protocol": "LSAPI",
"realm": "ls1.mydomain.com",
"sub-realm": null,
"targets": ["b9acdce6-3ce6-42db-82fc-39bf37c7a2b1", "5b696e8d-9875-45a5-b347-3b9fc288bad3"],
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
}
}
---> EXECUTE API
{
"jsonrpc": "2.0",
"method": "BLADE.execute",
"params": {
"realm": "ls1.mydomain.com",
"protocol": "LSAPI",
"method": "LSAPI.ls",
"params": {
"path": "/tmp/testing"
}
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 5
}
<--- SUCCESS (TBD FAIL CASE)
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"realm": "ls1.mydomain.com",
"protocol": "LSAPI",
"result": {
"listing": "-rw-r--r-- 1 root root 33881 May 3 17:22 blank_avatar.png\ndrwxr-xr-x 6 root root 4096 Oct 26 2016 dash.js\n-rw-r--r-- 1 root root 5266 May 3 17:20 foo.diff\n-rw-r--r-- 1 root root 485 May 3 17:22 ks.diff"
},
}
}
Endpoints subscribe to event channels on their Master.
If that Master is not the top tier Master, it in turn subscribes all of its distinct events to it's Master until it reaches the top tier.
When the Master is encounterd who holds a connection to the Controller for a particular protocol, the Master subscribes to that Controller.
---> EVENT SUB
{
"jsonrpc": "2.0",
"method": "BLADE.subscribe",
"params": {
"realm": "ls1.mydomain.com",
"protocol": "LSAPI",
"event-space": "LSAPI",
"params": {
"eventChannel": "someEvent",
"subParams": {"foo": "bar"}
}
"session-id": "5b696e8d-9875-45a5-b347-3b9fc288bad3",
"master-id": "5164f7f8-a6ca-4dd4-8f36-33db1dc9c35d",
},
"id": 6
}
<--- SUCCESS (TBD FAIL CASE)
{
"jsonrpc": "2.0",
"id": 6,
"result": {
"realm": "ls1.mydomain.com",
"protocol": "LSAPI",
"event-space": "LSAPI",
"result": {
"subscribedChannels": ["someEvent"],
"unauthorizedChannels": [],
"alreadySubscribedChannels": []
},
}
}