Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • addMessageListener(arg: { roomId: string }, callback: Function): Promise<void>
  • Adds a listener to a chatroom that calls passed callback function when event fires.

    since

    1.18.0

    example
    addMessageListener({roomId: string}, function(e){console.log(e)})
    

    Parameters

    • arg: { roomId: string }
      • roomId: string
    • callback: Function

    Returns Promise<void>

  • description

    Delete a chatroom message using messageId

    since

    2.36.0

    async
    example
    deleteMessage({
    roomId: "a147f914-d474-4cfb-81c6-4099404c435a",
    messageId: "dd810f9f-09d5-4c6b-a0df-e43dee9b2994"
    }).then((res) => console.log(res))

    Parameters

    Returns Promise<void>

  • getMessageCount Returns number of messages in chat room

    async
    example
    getMessageCount('c1f6082c-f7b9-4d1e-b64e-9071a3860ffc', {since: "2020-04-16T16:29:39.158Z"}).then(r => console.log(r.count))
    

    Parameters

    Returns Promise<IMessageCount>

  • getMessageList Returns array of message objects

    async
    example
    getMessageList({roomId: string}).then(list => console.log(list))
    

    Parameters

    Returns Promise<IMessageListPayload>

  • Removes listener from chatroom

    since

    1.18.0

    example
    removeMessageListener({roomId: string}, function(e){console.log(e)})
    

    Parameters

    Returns Promise<void>

  • sendMessage Send user message to chat room.

    async
    example
    sendMessage({message: 'Test message', roomId: 'c1f6082c-f7b9-4d1e-b64e-9071a3860ffc'})
    

    Parameters

    Returns Promise<IMessageResponsePayload>

  • description

    Upload a image to get image url for sending image message

    since

    2.43.0

    async
    example
    // For Web usage
    // get the image blob data from image uri, uri could be local file uri
    const imageBlob = await fetch(imageUri).then(res => res.blob())
    // create formdata and append "type" and "image" keys
    const imageFormData = new FormData();
    imageFormData.append('type', 'file')
    imageFormData.append('image', imageBlob)

    const { image_url } = await uploadImage({
    roomId: "<chat-room-id>",
    imageFormData: imageFormData
    });

    Parameters

    Returns Promise<IUploadImageResponse>

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Interface
  • Interface with type parameter
  • Enumeration

Generated using TypeDoc