Nevy
Nevy is a quic networking library built with quinn in bevy.
Getting started
To start a connection with quic you need an endpoint. An endpoint is an entity that contains the state machine for all of it's connections.
let endpoint_entity = commands
.spawn
.id;
To open a connection you insert the ConnectionOf component along with a ConnectionConfig.
This will also insert a QuicConnection onto the entity if opening the connection succeeds,
and will always insert a ConnectionStatus.
This component is an identifier for the connection within the endpoint.
commands.spawn;
Nevy uses relations between ConnectionOf and EndpointOf to represent it's connections.
This means that to respond to incoming connections you can query for added connections.
connection_q:
To interact with a QuicConnection you need to retrieve it's state from the QuicEndpoint it is a ConnectionOf.
This is a system that will send a message on a quic stream whenever a connection establishes.
,
,
>,
mut endpoint_q: ,
)
Lastly, when connections close the entity is not despawned nor are any of it's connection components removed. This is so that you can still retrieve the connection state from it's endpoint to read any remaining data. Make sure to despawn any closed connections once you are done with them.
The entity can be reused for another connection once it's ConnectionOf component is removed or replaced.
Bevy versions
| Bevy | Nevy |
|---|---|
| 0.16 | 0.1 |
| 0.17 | 0.2.3 |