How channels work in Quinnet
mainQuinnet provides three channel types to control delivery guarantees and ordering:
OrderedReliable: Guaranteed delivery and strict ordering (e.g., for chat).UnorderedReliable: Guaranteed delivery, but order is not preserved (e.g., for animation triggers).Unreliable: No guarantees on delivery or order (e.g., for high-frequency entity positions).
Channels can be pre-configured during connection/endpoint setup using SendChannelsConfiguration, or opened/closed dynamically at runtime. You can have up to 256 channels open simultaneously. Each connection/endpoint has a default channel used when no specific ChannelId is provided.
// Pre-configuring channels at startup
let channels_config = SendChannelsConfiguration::from_configs(vec![
ChannelConfig::default_ordered_reliable(), // ID 0
ChannelConfig::default_ordered_reliable(), // ID 1
ChannelConfig::default_unreliable(), // ID 2
]);
// Using channels on a client connection
let connection = client.connection();
connection.send_message(message); // Uses default
connection.send_message_on(channel_id, message); // Uses specific ID
connection.set_default_channel(channel_id); // Changes default
// Opening a new channel dynamically
let chat_channel = client.connection().open_channel(ChannelConfig::default()).unwrap();
client.connection().send_message_on(chat_channel, chat_message);