Skip to content
Cloudflare Docs

RTKChat

This is the chat module, which can be used to send and receive messages from the meeting.

module.exports ⏏

Kind: Exported class

new module.exports(context, chatSocketHandler, self, participants)

ParamType
contextContext
chatSocketHandlerRTKChatSocketHandler
selfSelf
participantsParticipants

module.exports.messages

Deprecated

Kind: instance property of module.exports

module.exports.telemetry

Kind: instance property of module.exports

module.exports.pinned

Kind: instance property of module.exports
Deprecated.: This property is deprectated. Please use fetchPinnedMessages() instead. Returns an array of pinned messages.

module.exports.setMaxTextLimit(limit)

Set the max character limit of a text message

Kind: instance method of module.exports

ParamTypeDescription
limitnumberMax character limit for a text message.

module.exports.sendMessageInternal(message, [participantIds])

Kind: instance method of module.exports

ParamTypeDescription
messageMessagePayloadMessage payload to send.
[participantIds]Array.<string>Participant ids to send the message to.

module.exports.sendTextMessageInternal(message, [peerIds])

Kind: instance method of module.exports

ParamTypeDescription
messagestringText message to send.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendImageMessageInternal(image, [peerIds])

Kind: instance method of module.exports

ParamTypeDescription
imageFile | ReactNativeFileImage file to send.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendFileMessageInternal(file, [peerIds])

Kind: instance method of module.exports

ParamTypeDescription
fileFile | ReactNativeFileFile to send.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.updateRateLimits(num, period)

Kind: instance method of module.exports

ParamType
numnumber
periodnumber

module.exports.sendTextMessage(message, [peerIds])

Sends a chat text message to the room.

Kind: instance method of module.exports

ParamTypeDescription
messagestringThe message that must be sent to the room.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendCustomMessage(message, [peerIds])

Kind: instance method of module.exports

ParamTypeDescription
messageCustomMessagePayloadCustom message payload.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendImageMessage(image, [peerIds])

Sends an image message to the meeting.

Kind: instance method of module.exports

ParamTypeDescription
imageFile | ReactNativeFileThe image that is to be sent.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendFileMessage(file, [peerIds])

Sends a file to the meeting.

Kind: instance method of module.exports

ParamTypeDescription
fileFile | ReactNativeFileA File object.
[peerIds]Array.<string>Peer ids to send the message to.

module.exports.sendMessage(message, [participantIds])

Sends a message to the meeting. This method can be used to send text, image, or file messages. The message type is determined by the key 'type' in message object.

Kind: instance method of module.exports

ParamTypeDescription
messageMessagePayloadAn object including the type and content of the message.
[participantIds]Array.<string>An array including the userIds of the participants.

module.exports.editTextMessage(messageId, message)

Kind: instance method of module.exports

ParamTypeDescription
messageIdstringId of the message to edit.
messagestringUpdated text message.

module.exports.editImageMessage(messageId, image)

Kind: instance method of module.exports

ParamTypeDescription
messageIdstringId of the message to edit.
imageFile | ReactNativeFileUpdated image file.

module.exports.editFileMessage(messageId, file)

Kind: instance method of module.exports

ParamTypeDescription
messageIdstringId of the message to edit.
fileFile | ReactNativeFileUpdated file.

module.exports.editMessage(messageId, message)

Kind: instance method of module.exports

ParamTypeDescription
messageIdstringId of the message to edit.
messageMessagePayloadUpdated message payload.

module.exports.deleteMessage(messageId)

Kind: instance method of module.exports

ParamTypeDescription
messageIdstringId of the message to delete.

module.exports.getMessagesByUser(userId)

Deprecated

Kind: instance method of module.exports

ParamTypeDescription
userIdstringThe user id of the user that sent the message.

module.exports.getMessagesByType(type)

Deprecated

Kind: instance method of module.exports

ParamTypeDescription
type'text' | 'image' | 'file' | 'custom' | 'poll''text', 'image', 'file', 'custom', or 'poll'.

module.exports.pin(id)

Pins a chat message

Kind: instance method of module.exports

ParamTypeDescription
idstringID of the message to be pinned

module.exports.unpin(id)

Unpins a chat message

Kind: instance method of module.exports

ParamTypeDescription
idstringID of the message to be unpinned

module.exports.fetchPublicMessages(options)

Fetches messages from the chat with pagination.

Kind: instance method of module.exports

ParamTypeDescription
optionsFetchMessageOptionsConfiguration options for fetching messages, including timestamp, limit, and direction for pagination.

module.exports.fetchPrivateMessages(options)

Fetches private messages between the current user and another participant with pagination.

Kind: instance method of module.exports

ParamTypeDescription
optionsFetchPrivateMessagesOptionsConfiguration options for fetching private messages, including private RTKChat ID (User ID of the participant) and pagination settings.

module.exports.fetchPinnedMessages(options)

Fetches pinned messages with pagination.

Kind: instance method of module.exports

ParamTypeDescription
optionsFetchMessageOptionsConfiguration options for fetching pinned messages, including timestamp, limit, and direction.

module.exports.getMessages(timeStamp, size, reversed, [offset])

Deprecated

Kind: instance method of module.exports

ParamTypeDefault
timeStampnumber
sizenumber
reversedboolean
[offset]number0

module.exports.searchMessages(query, [filters])

Deprecated

Kind: instance method of module.exports

ParamType
querystring
[filters]SearchFilters