Expand description

Implementation of the Imagine network protocol.

Provides a way to interact with Imagine over a IP network. It reflects the protocol and it’s original implementation by providing two types of a Connection: a Server, which binds to a socket, and a Client, which connects to one.

All connected users (the server and clients) are identified by a unique nickname and can exchange data in form of Messages. Anything that happens during a connection, like recieving a message or a nickname change, is represented by a Event.

Example: Echo messages back

let mut network: Client = Connection::connect("127.0.0.1:1060", "imaginet").await?;
while let Some(event_result) = network.next().await {
    match event_result? {
        Event::RecievedMessage { sender, message }
            => network.send(message, vec![sender]).await?,
        _ => (),
    }
}

Modules

Client related functionality.

General network related functionality.

Server related functionality.