sendMessage()
method and pass a TextMessage
object to it.
TextMessage
class. The initialize method of the TextMessage class takes the following mandatory parameters:
The TextMessage
class constructor takes the following parameters:
Parameters | Information |
---|---|
receiverID | The UID or GUID of the recipient |
text | The text to be sent |
receiverType | The type of the receiver to whom the message is to be sent i.e user or group |
TextMessage
object which includes all information related to the sent message.
TextMessage
. A metadata field is a dictionary
of type [String: Any]
which will be received as it was sent without any processing from CometChat. It can be used to send any additional data that needs to be sent along with a message.
sendMediaMessage()
method and pass a MediaMessage
object to it.
MediaMessage
class. The initialize method of the MediaMessage
class takes the following mandatory parameters:
Parameter | Description |
---|---|
receiverId | The UID or GUID of the recipient |
fileurl | The file path object to be sent |
messageType | The type of the message that needs to be sent which in this case can be: - image - video - audio - file |
receiverType | The type of the receiver to whom the message is to be sent - user - group |
MediaMessage
class containing all the information related to the sent media message.
MediaMessage
. A metadata field is a dictionary
of type [String: Any]
which will be received as it was sent without any processing from CometChat. It can be used to send any additional data that needs to be sent along with a message.
sendCustomMessage()
method.
The sendCustomMessage()
methods takes an object of the CustomMessage
which can be obtained using the below two constructor:
custom
.
The parameters involved are:
CustomMessage
class to set a specific type for the CustomeMessage.
Once the object of CustomMessage
class is ready you can send the custom message using the sendCustomMessage()
method.
CustomMessage
class.