Skip to content

How to use state in socket handler? #67

Answered by Totodore
trgsv asked this question in Q&A
Discussion options

You must be logged in to vote

You can't use axum state extractor with your handler because socketioxide is not an axum handler it is a middleware in front of axum (or anything based on hyper. Currently the lib lacks of some state management.

The only things you can use are Extensions with a cloned Arc of your state for each socket.

Or to clone an Arc of your state in each of your handler.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Totodore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants