Skip to content

API reference > @kontsedal/olas-realtime > RealtimeService

RealtimeService type ​

Consumer-implemented realtime transport. The package ships no default — apps wire their own (WebSocket, Pusher, Supabase Realtime, etc.) and pass the implementation through ctx.deps.realtime after augmentingAmbientDeps:

ts
declare module '@kontsedal/olas-core' {
  interface AmbientDeps {
    realtime: RealtimeService
  }
}

Signature:

typescript
export type RealtimeService = {
  subscribe<TEvent = unknown>(channel: string, handler: RealtimeHandler<TEvent>): RealtimeSubscription;
  onConnectionChange?(handler: (state: ConnectionState) => void): () => void;
};

References: RealtimeHandler, RealtimeSubscription, ConnectionState

Released under the MIT License.