Table of Contents

onChatMessage()

wrtc.onChatMessage() is an event function called when a chat message is received.

You must write your own wrtc.onChatMessage() function to be able to display received chat messages.

Arguments

wrtc.onChatMessage(msg)

Return value

Ignored.

Example

{type:"chat", from:"john.doe@company.com", from_dn:"John Doe", to:"foo@company.com", format:"text/plain", msg:"Hello!"}
{type:"chat", from:"foo@company.com", to:"john.doe@company.com", format:"iscomposing", msg:""}

wrtc.onChatMessage = function(msg) {
    if (msg.format == "iscomposing")
      -- display someone is composing an answer to you --
    else
      -- display received msg.msg --
}

See Also

wrtc.sendChatMessage()

wrtc.onChatMessageError()