-
Notifications
You must be signed in to change notification settings - Fork 172
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
An example of adding multiple middlewares. #581
An example of adding multiple middlewares. #581
Conversation
#[derive(Clone)] | ||
struct ThreadWatcher; | ||
impl middleware::Middleware for ThreadWatcher { | ||
type Instant = isize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can there be negative threads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, well, like the subtraction of "end - start" can be negative (these are system threads, so anything can happen while the program executes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess better safe than sorry, and it's just an example
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
* Squashed MethodSink * Middleware WIP * Passing all the information through * Unnecessary `false` * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Add a setter for middleware (#577) * Fix try-build tests * Add a middleware setter and an example * Actually add the example * Grumbles * Use an atomic * Set middleware with a constructor instead * Resolve a todo * Update ws-server/src/server.rs Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> * Update ws-server/src/server.rs Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> * Update ws-server/src/server.rs Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> * Middleware::on_response for batches * Middleware in HTTP * fmt * Server builder for HTTP * Use actual time in the example * HTTP example * Middleware to capture method not found calls * An example of adding multiple middlewares. (#581) * Add an example of adding multiple middlewares. * Update examples/multi-middleware.rs Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> * Update examples/Cargo.toml Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> * Move `Middleware` to jsonrpsee-types (#582) * Move `Middleware` to jsonrpsee-types * Move Middleware trait to jsonrpsee-types * Add some docs. * Link middleware to `with_middleware` methods in docs * Doctests * Doc comment fixed * Clean up a TODO * Switch back to `set_middleware` * fmt * Tests * Add `on_connect` and `on_disconnect` * Add note to future selves Co-authored-by: David <dvdplm@gmail.com>
No description provided.