-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on how to make custom extractors #374
Comments
I agree that custom extractor implementations lack examples and docs. However I'm curious about what you are trying to do, because if you want to access the axum state you simply have to make a shared state and add it to both axum and socketioxide with |
I want to access socket state not Axum state, I want to inject my database repositories in handler arguments (just I do with Axum) so I can't skip boilerplate in my socket handlers |
For your first point: For you second point: For your third point: |
Is your feature request related to a problem? Please describe.
I want to create a custom extrators for my app.
Describe the solution you'd like
Add an example of a extrator that access state.
Describe alternatives you've considered
Just docs
Additional context
I need to create my custom extrators but i found so far the following issues:
FromMessageParts
(or any of these handler traits), i can't get thejson_serde::Value
andbytes::Bytes
types (you should export these), i currently usingsqlx::types::JsonValue
andaxum::body::Bytes
.State::<T>::from_message_parts(s, v, p, ack_id)
which returnsResult<Self, StateNotFound<T>>
, so i have consum the result and covert to option usingok()
, and finallyunwrap()
the option, which is safe in my context but i think we need a better way to do this kind of extractors (axum gets the state as parameter in thefrom_request_parts
function).The text was updated successfully, but these errors were encountered: