The interface that clients (like the browser extension) use to communicate with backends. This is essentially the "bare minimum" of shared functionality that a client will use to communicate with a backend

Remarks

As a result of the multi-purpose design of the beta-* packages, clients can require additional functionality beyond this interface to match their environment. For example, the extension has a separate provider abstraction to bridge this interface into the browser environment.

Hierarchy

Implements

Constructors

Properties

_messageEvents: SocketEvent<any>[] = []
_onFetchPreferences: EventDispatcher<ICensorBackend, Partial<IPreferences>> = ...
_onImageCensored: EventDispatcher<ICensorBackend, ImageCensorResponse> = ...
_onPublishMessage: EventDispatcher<WebSocketTransportClient, EventPayload> = ...
_onReceiveStatistics: EventDispatcher<ICensorBackend, StatisticsData> = ...
_onUpdate: SimpleEventDispatcher<ActionPayload> = ...
_requestId?: string
_version: string = "0.0.0"
host: string
requestId?: string

This property was part of legacy functionality and will be removed in a future release.

Deprecated

defaultHost: string = "ws://localhost:8090/ws"

Accessors

Methods

  • Request cancellation of a previously sent censoring request.

    Parameters

    • request: CancelRequest

      Details of the censoring request to cancel.

    Returns Promise<void>

    Remarks

    Some backends may not support this, but should handle the cancellation request regardless.

  • Requests any assets of the specified type stored by the backend.

    Parameters

    • assetType: AssetType

      The asset type to fetch from the backend.

    Returns Promise<undefined | string[]>

    Remarks

    This is mostly used by clients to determine what backend-side assets are available for selection by the user (like stickers)

  • Parameters

    • response: any

    Returns Promise<any>

  • Requests that a backend should reset any stored censoring statistics.

    Returns Promise<boolean>

    Remarks

    Not all backends support this, nor do they have to honour this. If the backend doesn't support this, it will return a Promise<false> regardless.

  • Sends an object to the server using the current socket connection.

    Parameters

    • message: object

      The object to serialize and send.

    • Optional callback: (() => any)

      A callback to run after sending.

        • (): any
        • Returns any

    Returns void

Generated using TypeDoc