| // Typescript namespaces are weird when coming from multiple files. We generate |
| // all transitive dependencies into the same file in typescript so we can |
| // include all 'aos' flatbuffers we care about here. |
| include "aos/configuration.fbs"; |
| include "aos/network/connect.fbs"; |
| |
| namespace aos.web_proxy; |
| |
| // SDP is Session Description Protocol. We only handle OFFER (starting a |
| // transaction) and ANSWER responding to an offer. |
| enum SdpType : byte { |
| OFFER, |
| ANSWER |
| } |
| |
| // The SDP payload is an opaque string that describes what (media/data) we |
| // want to transmit. |
| table WebSocketSdp { |
| type:SdpType (id: 0); |
| payload:string (id: 1); |
| } |
| |
| // ICE is way for different peers to learn how to connect to each other. |
| // Because we will only be running in a local network, we don't have to support |
| // advaced features. |
| table WebSocketIce { |
| candidate:string (id: 0); |
| sdp_mid:string (id: 1); |
| sdp_m_line_index:int (id: 2); |
| } |
| |
| union Payload {WebSocketSdp, WebSocketIce} |
| |
| // We only send a single type of message on the websocket to simplify parsing. |
| table WebSocketMessage { |
| payload:Payload (id: 1); |
| } |
| |
| // WebRTC has size limits on the messages sent on datachannels. This message |
| // ensures that parts are recieved in the correct order. If there is any |
| // mismatch, all the existing work should be dropped and restart when reasonable |
| // data starts again. |
| table MessageHeader { |
| // Index of the channel in config |
| channel_index:uint (id: 0); |
| |
| // How many packets will be required for the message being sent. |
| packet_count:uint (id: 1); |
| // What index into the the total packets for the multipart message, this |
| // header is parts of. |
| packet_index:uint (id: 2); |
| |
| // Total number of bytes in the message |
| length:uint (id: 3); |
| |
| // Index into the sequence of messages. This will not always increase. |
| queue_index:uint (id: 4); |
| |
| data:[ubyte] (id: 5); |
| |
| // Time at which the message was sent, in nanoseconds. |
| monotonic_sent_time:long (id: 6); |
| } |
| |
| enum TransferMethod : byte { |
| SUBSAMPLE, |
| LOSSLESS, |
| } |
| |
| table ChannelRequest { |
| channel:Channel (id: 0); |
| method:TransferMethod (id: 1); |
| } |
| |
| // This is used to communicate the most recently received message by the client. |
| // This allows the server to avoid overloading the client (which we've had |
| // issues with in the past). |
| table ChannelState { |
| // queue_index and packet_index correspond to the similarly named fields in |
| // MessageHeader. |
| queue_index:uint (id: 0); |
| packet_index:uint (id: 1); |
| } |
| |
| table SubscriberRequest { |
| // The channels that we want transfered to this client. |
| channels_to_transfer:[ChannelRequest] (id: 0); |
| } |