Teaspeak-Server/MusicBot/Protocol.md

249 lines
4.7 KiB
Markdown
Raw Normal View History

# Musik bot websocket protocol
## General structure
Transmitted data is in json format
The json format has the structure as following:
```
{
"type": <PacketType>,
"data": [
{
<key>: value
},
...
]
}
```
Example:
```
{
"type": "showMessage",
"data": [
{
"message": "A simple info modal",
"type": "info"
},
{
"message": "A simple error modal",
"type": "error"
}
]
}
```
## TODO list
* Music bot queue
* Music bot ts3 access rights (allow other clients to use this music bot etc.)
## Packet types
### General types
#### Server `showMessage`:
This packet should show up a message modal.
* **[~]**
* `message`: <msg>
* `type`: {info|error}
#### Server `reqError`:
The server sends this if you applay a invalid request
* **[1]**
* `message`: <msg>
* `requestId`: <reqestId>
#### Server `disconnect`
I send this packet before i close the comunication
* **[1]**
* `message`
___
### Login packets
#### Client `login`
Try login
* **[1]**
* `username`
* `password`
* `requestId`
#### Server `notifylogin`
* **[1]**
* `requestId`
* `succeeded`: {0|1}
* `uid` own uid. only set if login failed
* `message` only set if login failed
#### Client `logout`
* **[1]**
* `requestId`
#### Server `notifylogout`
Could be send at any time (force logout)
* **[1]**
* `requestId` (empty of not requested)
* `succeeded`: {0|1}
___
### Server Management
#### Client `serverlist`
* **[1]**
* `requestId`
#### Server `notifyserverlist`
Sends when requested or list updated
(Lists online avariable server for the client view)
* **[~]**
* [1] `requestId` (empty of not requested)
* `name`
* `uid`
* `serverId`
* `status`: {online|offline}
* `clientOnline`
* `maxClients`
#### Server `notifyserverupdate`
Sends when a server changes display properties
* **[1]**
* `serverId`
* `key`: {name|onlineClients|maxClients}
* `value`
___
### Channel Management
#### Client `channellist`
Request a channel list
* **[1]**
* `requestId`
* `serverId`
#### Server `notifychannellist`
The channel response is ordered:
This packet would also be send if the channel tree gets updated
```
root
- sub 1
- sub sub 1
- sub sub 2
- sub 2
root 2
...
```
* **[~]**
* [1] `requestId` (empty of not requested)
* [1] `serverId`
* `name`
* `channelId`
* `channelParent`
* `channelOrder`
___
### Music bot management
#### Client `musicbotlist`
* **[1]**
* `requestId`
* `serverId`
#### Server `notifymusikmusicbotlist`
* **[~]**
* [1] `requestId` (empty of not requested)
* [1] `serverId`
* `id`
* `connected`: {1|0}
* `name`
* `channelId`
* `ownerUid` (its your own if its matching with our own id)
* `ownerCldbid`
#### Client `musicbotcreate`
* **[1]**
* `requestId`
* `serverId`
* `name`
* `channelId`
#### Server `notifymusikbotcreated`
* **[1]**
* `requestId` (empty of not requested)
* `serverId`
* `id`
* `connected`: {1|0}
* `name`
* `channelId`
* `ownerUid` (its your own if its matching with our own id)
* `ownerCldbid`
#### Client `musicbotdelete`
* **[1]**
* `requestId`
* `serverId`
* `name`
* `channelId`
#### Server `notifymusikbotdelete`
* **[1]**
* `requestId` (empty of not requested)
* `serverId`
* `id`
#### Client `musicbotinfo`
Request music bot info
* **[1]**
* `requestId`
* `serverId`
* `id`
#### Server `notifymusicbotinfo`
* **[1]**
* `requestId`
* `serverId`
* `id`
* `name`
* `connected`
* `phoeticName`
* `channelId`
* `playing`
* `playingInfo`: <string|Current playing title etc. May need to be inproved> Empty if noting selected
* `description`
* `textCurrentSong`
#### Client `musicbotedit`
* **[1]**
* `requestId`
* `serverId`
* `id`
* `key`
* `value`
#### Server `notifymusicbotedit`
* **[~]**
* [1] `requestId` (empty of not requested)
* [1] `serverId`
* `id`
* `key`: {connected|name|channelId|description|playing|playingInfo}
#### Client `musicbotplay`
* **[1]**
* `requestId`
* `serverId`
* `id`
* `type`: {yt|file}
* `value`
#### Server `notifymusicbotplay`
Send only as answer for `musicbotplay`
You would recive the play state update via `notifymusicbotedit`
* **[1]**
* `requestId`
* `succeeded`
*
#### Client `musicbotstop`
* **[1]**
* `requestId`
* `serverId`
* `id`
* `paused`: {1|0}
#### Server `notifymusicbotstop`
Send only as answer for `musicbotstop`
You would recive the play state update via `notifymusicbotedit`
* **[1]**
* `requestId`
* `succeeded`