Enum msgpacknet::Event
[−]
[src]
pub enum Event<M: Message, N: NodeId, I: InitMessage> { Message(N, M), ConnectionRequest(ConnectionRequest<M, N, I>), Connected(N), Disconnected(N), Closing, Closed, }
The enum used for events
Variants
Message(N, M)A received message
This event is emitted whenever a new message is received from any connection.
ConnectionRequest(ConnectionRequest<M, N, I>)An incoming connection request
This event is emitted whenever a new incoming connection is established and the
initialization message has been received.
To accept the connection accept(...)
has to be called.
Note: The connection has not been registered in the node and can't be used to send any messages yet.
Connected(N)A new estasblished connection
This event is emitted whenever a new connection has been established and can be used to send messages.
Disconnected(N)A lost connection
This event is emitted whenever a connection has been lost and can no longer be used to send messages.
Note: This event is emitted after the connection has been closed and unregistered, so it can't be used to send final messages on that connection.
Note 2: This event will not be emitted if a duplicate connection to the same node is closed.
ClosingNode closing
This event is emitted whenever the node is shutting down. At this time, all connections are still active and can be used to send final messages.
ClosedNode closed
This event is emitted whenever the node has shut down. At this time, all connections have been closed and no final messages can be sent.