Table of Contents
sendChatMessage()
wrtc.sendChatMessage() sends a text message. Supplied arguments are the address to send the message to and the text message.
Arguments
wrtc.sendChatMessage(to, msg)
- to - string containing address to send message to. Multiple addresses can be specified, separated by comma.
- msg - string containing the message to send, or 0 to indicate "iscomposing"
Returns
Nothing.
Events
No events are raised by wrtc.sendChatMessage().
The client at the other end, receiving the text message will however get a wrtc.onChatMessage() event.
Composing
By replacing text message with a 0 an "iscomposing" message is sent, to alert other end you are typing your response.
wrtc.sendChatMessage("adam@foo.com", 0) sends an iscomposing message to adam@foo.com
Example
wrtc.sendChatMessage("adam@foo.com", "Hello!")
sends text message "Hello!" to adam@foo.com
Tips & Tricks
wrtc.getCalls("inGroupCall").forEach(function(call) {wrtc.sendChatMessage(call.getPartner(), "Hello!")})
send text message "Hello!" to everyone in current group call