Skip to main content

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.

  1. Message Capture: The interceptor is triggered immediately when a message enters the channel over a live connection.
  2. Input Validation: The payload is validated against the configured input JSON schema.
  3. Processing: The interceptor executes its logic (validation, transformation, routing, or filtering).
  4. Execution Model:
  • Synchronous: The pipeline pauses until the interceptor returns a response.
  • Asynchronous: The pipeline continues while the interceptor processes in the background.
  1. Response Handling: The interceptor responds with resolve (success) or reject (failure), influencing message flow accordingly.
  2. Forwarding: The processed or validated message moves to the next interceptor or recipient in real time.