Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PgChannel

A channel to Postgres that tracks the subscription to a given Postgres channel using the LISTEN/UNLISTEN commands.

When paused the channel discards the messages.

Hierarchy

  • PgChannel

Implements

  • any

Index

Methods

endHandler

  • endHandler(endHandler: ((res: void) => void) | Handler<void> | null | undefined): PgChannel
  • Set an handler to be called when no more notifications will be received.

    Parameters

    • endHandler: ((res: void) => void) | Handler<void> | null | undefined

    Returns PgChannel

exceptionHandler

  • exceptionHandler(handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined): PgChannel
  • Parameters

    • handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined

    Returns PgChannel

fetch

  • fetch(arg0: number): ReadStream<string>
  • Parameters

    • arg0: number

    Returns ReadStream<string>

handler

  • handler(handler: ((res: string) => void) | Handler<string> | null | undefined): PgChannel
  • Set or unset an handler to be called when a the channel is notified by Postgres.

    • when the handler is set, the subscriber sends a LISTEN command if needed
    • when the handler is unset, the subscriber sends a UNLISTEN command if needed

    Parameters

    • handler: ((res: string) => void) | Handler<string> | null | undefined

    Returns PgChannel

pause

  • Pause the channel, all notifications are discarded.

    Returns PgChannel

pipe

  • pipe(): Pipe<string>
  • Returns Pipe<string>

pipeTo

  • pipeTo(dst: WriteStream<string>): PromiseLike<void>
  • pipeTo(dst: WriteStream<string>, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Parameters

    • dst: WriteStream<string>

    Returns PromiseLike<void>

  • Parameters

    • dst: WriteStream<string>
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

resume

  • Resume the channel.

    Returns PgChannel

subscribeHandler

  • subscribeHandler(handler: ((res: void) => void) | Handler<void>): PgChannel
  • Set an handler called when the the channel get subscribed.

    Parameters

    • handler: ((res: void) => void) | Handler<void>

    Returns PgChannel

Generated using TypeDoc