mirror of https://github.com/nealey/vail.git
Updated Geek Stuff (markdown)
parent
8c0a558986
commit
1b60260267
|
@ -1,43 +1,10 @@
|
|||
# Message Format
|
||||
# Protocol
|
||||
|
||||
Vail uses [WebSockets](https://en.wikipedia.org/wiki/WebSocket) at https://vail.woozle.org/chat?repeater=Foo. It accepts two subprotocols: both of these provide the same message information, in different encodings.
|
||||
The Vail websockets protocol is described in [protocol.md](https://github.com/nealey/vail/blob/main/docs/protocol.md)
|
||||
|
||||
The server will accept packets in either format, but will only send packets in the format described by the subprotocol.
|
||||
The [API demo](https://vail.woozle.org/testing/api-demo.html) will help if you are writing JavaScript.
|
||||
|
||||
## Subprotocol `binary.vail.woozle.org`
|
||||
|
||||
Network byte order, "binary" version of a Message structure. To send messages in this format, be sure you specify a binary WebSocket message.
|
||||
|
||||
```go
|
||||
// Message is a single Vail message.
|
||||
type Message struct {
|
||||
// Timestamp of this message. Milliseconds since epoch.
|
||||
Timestamp int64
|
||||
|
||||
// Number of connected clients.
|
||||
Clients uint16
|
||||
|
||||
// Message timing in milliseconds.
|
||||
// Timings alternate between tone and silence.
|
||||
// For example, `A` could be sent as [80, 80, 240]
|
||||
Duration []uint16
|
||||
}
|
||||
```
|
||||
|
||||
## Subprotocol `json.vail.woozle.org`
|
||||
|
||||
A JSON encoded version of the message structure.
|
||||
Be sure to specify a text WebSocket message.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"Timestamp": 1654548878301,
|
||||
"Clients": 3,
|
||||
"Duration": [101, 100, 103, 98, 97, 106, 315]
|
||||
}
|
||||
```
|
||||
The [protocol demo](https://vail.woozle.org/testing/protocol-demo.html) will help if you are working with Arduino or another language.
|
||||
|
||||
|
||||
# How Vail Gets Realtime Morse Code across the Internet
|
||||
|
|
Loading…
Reference in New Issue