The [`EngineIoHandler`] trait can be implemented on any struct to handle socket events A `Data` associated type can be specified to attach a custom state to the sockets
| 50 | /// |
| 51 | /// A `Data` associated type can be specified to attach a custom state to the sockets |
| 52 | pub trait EngineIoHandler: std::fmt::Debug + Send + Sync + 'static { |
| 53 | /// Data associated with the socket. |
| 54 | type Data: Default + Send + Sync + 'static; |
| 55 | |
| 56 | /// Called when a new socket is connected. |
| 57 | fn on_connect(self: Arc<Self>, socket: Arc<Socket<Self::Data>>); |
| 58 | |
| 59 | /// Called when a socket is disconnected with a [`DisconnectReason`] |
| 60 | fn on_disconnect(&self, socket: Arc<Socket<Self::Data>>, reason: DisconnectReason); |
| 61 | |
| 62 | /// Called when a message is received from the client. |
| 63 | fn on_message(self: &Arc<Self>, msg: Str, socket: Arc<Socket<Self::Data>>); |
| 64 | |
| 65 | /// Called when a binary message is received from the client. |
| 66 | fn on_binary(self: &Arc<Self>, data: Bytes, socket: Arc<Socket<Self::Data>>); |
| 67 | } |
nothing calls this directly
no outgoing calls
no test coverage detected