pub struct Setup {
pub version: Version,
pub keepalive: u32,
pub max_lifetime: u32,
pub resume_identification_token: Bytes,
pub metadata_mime_type: Bytes,
pub data_mime_type: Bytes,
pub metadata: BytesMut,
pub data: BytesMut,
/* private fields */
}
Expand description
SETUP Frame (0x01)
Setup frames MUST always use Stream ID 0 as they pertain to the connection.
The SETUP frame is sent by the client to inform the server of the parameters under which it desires to operate. The usage and message sequence used is shown in Connection Establishment.
One of the important parameters for a connection is the format, layout, and any schema of the data and metadata for frames. This is, for lack of a better term, referred to here as “MIME Type”. An implementation MAY use typical MIME type values or MAY decide to use specific non-MIME type values to indicate format, layout, and any schema for data and metadata. The protocol implementation MUST NOT interpret the MIME type itself. This is an application concern only.
The encoding format for Data and Metadata are included separately in the SETUP.
§Frame Contents
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Stream ID = 0 |
+-----------+-+-+-+-+-----------+-------------------------------+
|Frame Type |0|M|R|L| Flags |
+-----------+-+-+-+-+-----------+-------------------------------+
| Major Version | Minor Version |
+-------------------------------+-------------------------------+
|0| Time Between KEEPALIVE Frames |
+---------------------------------------------------------------+
|0| Max Lifetime |
+---------------------------------------------------------------+
| Token Length | Resume Identification Token ...
+---------------+-----------------------------------------------+
| MIME Length | Metadata Encoding MIME Type ...
+---------------+-----------------------------------------------+
| MIME Length | Data Encoding MIME Type ...
+---------------+-----------------------------------------------+
Metadata & Setup Payload
§Note
A server that receives a Setup
frame that has
FrameFlags::RESUME
Enabled set, but does not support resuming
operation, MUST reject the SETUP with an
ErrorCode::RejectedSetup
Fields§
§version: Version
§keepalive: u32
Unsigned 31-bit integer of Time (in milliseconds) between KEEPALIVE frames that the client will send. Value MUST be > 0.
- For server-to-server connections, a reasonable time interval between client KEEPALIVE frames is 500ms.
- For mobile-to-server connections, the time interval between client KEEPALIVE frames is often > 30,000ms.
max_lifetime: u32
Unsigned 31-bit integer of Time (in milliseconds) that a client will allow a server to not respond to a KEEPALIVE before it is assumed to be dead. Value MUST be > 0.
resume_identification_token: Bytes
Token used for client resume identification (Not present if
R
flag is not set).
metadata_mime_type: Bytes
MIME Type for encoding of Metadata.
This SHOULD be a US-ASCII string that includes the Internet media type specified in RFC 2045. Many are registered with IANA such as CBOR. Suffix rules MAY be used for handling layout.
For example, application/x.netflix+cbor or application/x.reactivesocket+cbor or application/x.netflix+json.
The string MUST NOT be null terminated.
data_mime_type: Bytes
MIME Type for encoding of Data.
This SHOULD be a US-ASCII string that includes the Internet media type specified in RFC 2045. Many are registered with IANA such as CBOR. Suffix rules MAY be used for handling layout.
For example, application/x.netflix+cbor or application/x.reactivesocket+cbor or application/x.netflix+json.
The string MUST NOT be null terminated.
metadata: BytesMut
Setup Metadata
Includes payload describing connection capabilities of the endpoint sending the Setup header.
data: BytesMut
Setup Data
Includes payload describing connection capabilities of the endpoint sending the Setup header.
Implementations§
Source§impl Setup
impl Setup
Sourcepub fn set_resume_identification_token(
&mut self,
resume_identification_token: Bytes,
)
pub fn set_resume_identification_token( &mut self, resume_identification_token: Bytes, )
Sets the value of Setup.resume_identification_token
Sourcepub fn set_metadata(&mut self, metadata: BytesMut)
pub fn set_metadata(&mut self, metadata: BytesMut)
Sets the value of Setup.metadata
Sourcepub const fn builder() -> SetupBuilder
pub const fn builder() -> SetupBuilder
Creates a builder to builder a frame of this type.