Client ~ ChatInterface Schema - UofM-COMP4350-4/NBGI GitHub Wiki

Draft 1

Interprets and sends raw Socket.IO data for client side chat; sending and receiving chat APIs.

##Socket.IO Emits Event name: "chat"

Sends a text chat message to the server.

  • Event data:
{
    instanceID:0, // {Number} - instance ID for the match chatroom
    text:"" // {String} - chat message text
}

##Socket.IO Receives Event name: "chat"

Receives a text chat message from the server.

  • Event data:
{
    instanceID:0, // {Number} - instance ID for the match chatroom
    text:"" // {String} - chat message text
    userName:"" // {String} - chat message sender's user name
}

##Component Events Event name: "onChat"

Sent when a text chat message is received.

  • Event data:
{
    instanceID:0, // {Number} - instance ID for the match chatroom
    text:"" // {String} - chat message text
    userName:"" // {String} - chat message sender's user name
}

##Component API sendMessage(instance, text)

  • instance {Number} - instance ID for the match chatroom
  • text {String} - chat message text