A way to inject database connection in websocket #659
-
Hello, I want to use the database in websocket, but it seems to me that this is not possible. Is there a way other than making the database static? |
Beta Was this translation helpful? Give feedback.
Answered by
chrislearn
Jan 20, 2024
Replies: 1 comment 1 reply
-
How about use closure? just like this example move user into closure? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
TheAwiteb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about use closure? just like this example move user into closure?
https://github.com/salvo-rs/salvo/blob/89b36ab2a53c13e7b72cd146f929ff4c007fae6c/examples/websocket/src/main.rs#L11C1-L31C2