function sendMessage() {
      // Create a new message object
      var message = {
        text: vm.messageText
      };

      // Emit a 'chatMessage' message event
      Socket.emit('chatMessage', message);

      // Clear the message text
      vm.messageText = '';
    }
// Create a controller method for sending messages
Create a controller method for sending messages
Create a controller method for sending messages
function sendMessage() {
      var message = {
        text: vm.messageText
      };
      Socket.emit('chatMessage', message);
      vm.messageText = '';
    }
function sendMessage ( ) { var message = { text : vm . messageText } ; Socket . emit ( 'chatMessage' , message ) ; vm . messageText = '' ; }
Create a controller method for sending messages
Create a controller method for sending messages
// Create a new message object // Emit a 'chatMessage' message event // Clear the message text