harmony protocol v0.0.1 # Introduction The harmony protocol uses [JSON](https://en.wikipedia.org/wiki/JSON) as its message format. Servers are assigned IDs upon creation starting at 10. This ID may be used to specify which instance to join or connect to. Example join link: https://harmony.rocketnine.space/join/44 When an ID is not specified, the first server instance (ID 10) is assumed. Specifying a server ID is only required when initially connecting. # Voice communication overview [WebRTC](https://webrtc.org) facilitates voice communication. When a client requests to join a voice channel, the server is sent one or more `Call` commands to initiate audio connections. Once at least one connection is established, the client will send the server a `Join` command with a voice channel ID. Current implementations establish three audio connections and route incoming audio over the first available connection. This may change. # Channel types | # | Description | | --- | --- | | 1 | Text | | 2 | Voice | # Messages | # | Name | Description | Syntax | | --- | --- | --- | --- | | 110 | Connect | Connect to a server | `{ T: 110, S: , U: "", P: "" }` Request to connect
`{ T: 110, U: "" }` Notification of user connecting | | 101 | Ping | Request to ensure connection is still active | `{ T: 101, M: "" }` | | 102 | Pong | Reply ensuring connection is still active | `{ T: 102, M: "" }` | | 120 | Chat | Chat message | `{ T: 120, C: , M: "" }` Request to send message
`{ T: 120, U: "", M: "" }` Notification of message | | 103 | Call | Initiate voice connection with server | `{ T: 103, M: "" }` | | 104 | Answer | Reply to initiate voice connection with server | `{ T: 104, M: "" }` | | 111 | Join | Join a voice channel | `{ T: 111, C: , P: "" }` Request to join
`{ T: 111, C: , U: "" }` Notification of user joining | | 112 | Quit | Quit a voice channel | `{ T: 112, C: }` Request to quit
`{ T: 112, C: , U: "" }` Notification of user quitting | | 123 | TransmitStart | Notification of voice activity starting | `{ T: 123, S: }` | | 124 | TransmitStop | Notification of voice activity stopping | `{ T: 124, S: }` | | 131 | Channels | Channel list | `{ T: 131, M: "[{\"ID\": ,\"Type\": ,\"Name\": \"\",\"Topic\": \"\"}]" }` | | 132 | Users | User list | `{ T: 132, M: "[{\"ID\": ,\"N\": \"\",\"C\": \"\"}]" }` | | 119 | Disconnect | Disconnect from a server | `{ T: 119 }` Request to disconnect
`{ T: 119, U: "" }` Notification of user disconnecting |