Used to communicate with the dddice API and live server. This is typically not initialized directly by a developer but created after calling ThreeDDice#connect.


  • ThreeDDiceAPI


  • The constructor of the ThreeDDiceAPI class


    • Optional apiKey: string

      The API key used to communicate with the server

    Returns ThreeDDiceAPI


  • Connect to the live server and begin listening to room events.

    If called more than once, this method does nothing.

    Note: Your user must be a participant in a room in order to listen to events, otherwise an error is thrown.


    • roomSlug: string

      Room slug to listen on

    • Optional roomPasscode: string

      Private passcode to access room

    Returns ThreeDDiceAPI

  • Execute a callback when the connection state changes.


    APIConnectError if the live connection has not been established


    • callback: ((state: string) => any)

      The function to execute when the connection state changes

        • (state: string): any
        • Parameters

          • state: string

          Returns any

    Returns ThreeDDiceAPI


roll: { create: ((dice: IDiceRoll[]) => Promise<IApiResponse<"roll", IRoll>>); get: ((id: string) => Promise<IApiResponse<"roll", IRoll>>) } = ...

API Roll Actions

Type declaration

room: { list: (() => Promise<IApiResponse<"room", IRoom>>); create: (() => Promise<IApiResponse<"room", IRoom>>); get: ((slug: string) => Promise<IApiResponse<"room", IRoom>>); join: ((slug: string) => Promise<IApiResponse<"room", IRoom>>); leave: ((slug: string, participantId?: string) => Promise<IApiResponse<"room", IRoom>>) } = ...

API Room Actions

Type declaration

Generated using TypeDoc