abstract class
Telecr::Core::Middleware
- Telecr::Core::Middleware
- Reference
- Object
Overview
Abstract base class that all middleware must inherit from.
Middleware allows you to intercept and process updates before they reach your handlers. Common use cases include:
- Logging and Analytics
- Authentication and Authorization
- Session Management
- Rate Limiting
Direct Known Subclasses
Defined in:
core/composer.crcore/middleware.cr
Instance Method Summary
-
#call(ctx : Context, next_mw : Context -> )
Execute the middleware logic.
Instance Method Detail
Execute the middleware logic.
To continue the chain, call next_mw.call(ctx).
To stop the execution (short-circuit), simply do not call next_mw.
@param ctx [Context] The current context wrapping the Telegram Update. @param next_mw [Proc(Context, Nil)] The next middleware or final handler in the chain.