@inrupt/solid-client-notifications
    Preparing search index...

    Constructor for a WebSocket Notification instance, which allows subscribing to resources in the solid ecosystem. See the Solid Notifications Protocol Specification for more details.

    import { getDefaultSession } from '@inrupt/solid-authn-browser';
    // or for node.js:
    // import { Session } from '@inrupt/solid-authn-node';

    const session = getDefaultSession();
    // for node.js:
    // const session = new Session();
    // await session.login({
    // oidcIssuer,
    // clientId,
    // clientSecret,
    // });

    const socket = new WebsocketNotification(parentContainerUrl, {
    fetch: session.fetch,
    });

    socket.on("message", (notification) => {
    console.log("Change:", notification);
    });

    // Connect for receiving notifications:
    await socket.connect();

    // later:
    socket.disconnect();

    Hierarchy

    • LiveNotification
      • WebsocketNotification

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Connects the websocket to start receiving notifications. If no providedEndpoint or providedSubprotocol parameter is present, then those will automatically be discovered based on the capabilities of the host of the resource that you're subscribing to notifications for.

      Parameters

      • OptionalprovidedEndpoint: string
      • OptionalprovidedSubprotocol: string

      Returns Promise<void>

    • Removes a listener for the "connected" event

      Parameters

      • eventName: string
      • listener: (...args: any[]) => void

      Returns this

    • Emitted when the connection is established

      Parameters

      • eventName: string
      • listener: (...args: any[]) => void

      Returns this

    • Emitted when the next connection is established

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this