Skip to content

Commit c4dcfcf

Browse files
authored
doc(socketio/connect): specify middleware behavior for Data extractor
1 parent f5b82b7 commit c4dcfcf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

socketioxide/src/handler/extract.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
//! ### Extractors for [`ConnectHandler`](super::ConnectHandler), [`MessageHandler`](super::MessageHandler)
1+
//! ### Extractors for [`ConnectHandler`](super::ConnectHandler), [`ConnectMiddleware`](super::ConnectMiddleware),
2+
//! [`MessageHandler`](super::MessageHandler)
23
//! and [`DisconnectHandler`](super::DisconnectHandler).
34
//!
45
//! They can be used to extract data from the context of the handler and get specific params. Here are some examples of extractors:
56
//! * [`Data`]: extracts and deserialize to json any data, if a deserialization error occurs the handler won't be called:
67
//! - for [`ConnectHandler`](super::ConnectHandler): extracts and deserialize to json the auth data
8+
//! - for [`ConnectMiddleware`](super::ConnectMiddleware): extract and deserialize to json the auth data.
9+
//! In case of error, the middleware chain stops and a `connect_error` event is sent.
710
//! - for [`MessageHandler`](super::MessageHandler): extracts and deserialize to json the message data
811
//! * [`TryData`]: extracts and deserialize to json any data but with a `Result` type in case of error:
9-
//! - for [`ConnectHandler`](super::ConnectHandler): extracts and deserialize to json the auth data
12+
//! - for [`ConnectHandler`](super::ConnectHandler) and [`ConnectMiddleware`](super::ConnectMiddleware):
13+
//! extracts and deserialize to json the auth data
1014
//! - for [`MessageHandler`](super::MessageHandler): extracts and deserialize to json the message data
1115
//! * [`SocketRef`]: extracts a reference to the [`Socket`]
1216
//! * [`Bin`]: extract a binary payload for a given message. Because it consumes the event it should be the last argument

0 commit comments

Comments
 (0)