Options
All
  • Public
  • Public/Protected
  • All
Menu

WebCollabServer is the Web collaboration server component. It supports both simple mode (non-clustering) and cluster mode. The simple mode is used by default. To enable the clustering,MemberStateService and MessageQueue should be declared.

Hierarchy

  • WebCollabServer

Index

Constructors

  • Constructor that creates a web collaboration server.

    Parameters

    • options: { cluster?: { memberStateService?: MemberStateService; messageQueue?: MessageQueue; serverId: string }; databaseConfig: DatabaseConfig; logger?: LoggerOptions; messageHandler?: MessageHandler; userService: UserService }
      • Optional cluster?: { memberStateService?: MemberStateService; messageQueue?: MessageQueue; serverId: string }
        • If not provided: a standalone(non-clustering) server is started.
        • If provided: a server is started and joins the cluster with serverId.
        • Optional memberStateService?: MemberStateService

          A custom MemberStateService. If not provided, a default MemberStateService implementation will be used.

        • Optional messageQueue?: MessageQueue

          A custom MessageQueue. If not provided, a default MessageQueue based on Redis will be used. The Redis URL should be provided as an environment variable when starting the collaboration server, like REDIS_URL="redis://127.0.0.1:6379".

        • serverId: string

          An identifier for the server which should be unique in the same cluster.

      • databaseConfig: DatabaseConfig

        The config of the database.

      • Optional logger?: LoggerOptions

        An optional logger configuration.

        If not provided, the default configuration will be used. Which is equivalent to:

         {
        level: 'info',
        autoLogging: false,
        }

        Internally, pino and pino-http are used. Your can pass pino-http options directly, and it will be passed to pino-http.

      • Optional messageHandler?: MessageHandler

        An optional messageHandler

      • userService: UserService

        A UserService implementation.

    Returns WebCollabServer

Methods

  • createCollaboration(collaboration: { docName: string; fileUrl: string; isDocPublic: boolean; ownerId: string }): Promise<{ id: string }>
  • Create collaboration.

    Parameters

    • collaboration: { docName: string; fileUrl: string; isDocPublic: boolean; ownerId: string }
      • docName: string

        The document name of the collaboration.

      • fileUrl: string

        The URL of the PDF file to enable collaboration.

      • isDocPublic: boolean
        • true: Anyone can access this collaboration.
        • false: Only the specified members can access this collaboration.
      • ownerId: string

        The owner of the document.

    Returns Promise<{ id: string }>

  • start(port?: number): Promise<void>
  • Start the collaboration server.

    Parameters

    • port: number = 8080

      The port the server will listen on, 8080 by default.

    Returns Promise<void>

  • stop(): Promise<void>
  • Stop the collaboration server.

    Returns Promise<void>

Generated using TypeDoc