src/protocol/messages.js
function newMessage(type, parentMessage, content, metadata) {
  var header = {
    msg_type: type,
    msg_id: uuid.v4(),
    session: parentMessage.header.session,
    username: parentMessage.header.username
  };

  metadata = metadata || {};
  content = content || {};
  return createMessage(parentMessage.identities, header, parentMessage.header,
                       metadata, content);
}
function newMessage(type, parentMessage, content, metadata) {
  var header = {
    msg_type: type,
    msg_id: uuid.v4(),
    session: parentMessage.header.session,
    username: parentMessage.header.username
  };

  metadata = metadata || {};
  content = content || {};
  return createMessage(parentMessage.identities, header, parentMessage.header,
                       metadata, content);
}
function newMessage ( type , parentMessage , content , metadata ) { var header = { msg_type : type , msg_id : uuid . v4 ( ) , session : parentMessage . header . session , username : parentMessage . header . username } ; metadata = metadata || { } ; content = content || { } ; return createMessage ( parentMessage . identities , header , parentMessage . header , metadata , content ) ; }
Creates a new message of the specified type, in association to a parent (incoming message) and optional metadata and content.
Creates a new message of the specified type in association to a parent ( incoming message ) and optional metadata and content .