Real-time Connection Interceptors
Real-time interceptors operate over persistent connections such as WebSocket or Server-Sent Events (SSE). They process messages instantly as they flow through the channel, making them ideal for low-latency, event-driven communication. Unlike HTTP interceptors, they run directly within the live message pipeline, ensuring immediate impact on delivery and message state.
This model is best suited for scenarios where real-time validation, moderation, or transformation is critical before the message reaches its destination.
How it works
Real-time interceptors bring instant, in-pipeline processing to live channels, ensuring that messages are checked, modified, or enriched on the fly before delivery.
- Message Capture: The interceptor is triggered immediately when a message enters the channel over a live connection.
- Input Validation: The payload is validated against the configured input JSON schema.
- Processing: The interceptor executes its logic (validation, transformation, routing, or filtering).
- Execution Model:
- Synchronous: The pipeline pauses until the interceptor returns a response.
- Asynchronous: The pipeline continues while the interceptor processes in the background.
- Response Handling: The interceptor responds with resolve (success) or reject (failure), influencing message flow accordingly.
- Forwarding: The processed or validated message moves to the next interceptor or recipient in real time.