title: Not showing client welcome message in socket.io / node.js
body: <p>i made a primitive chatroom in nodejs and socket.io <a href="http://billischill.ddns.net:3000" rel="nofollow">here</a> and i am trying to get it to display the username and a welcome message to just the user as well as a message that shows all the other users that he/she joined here is my code </p>
  
  <p>server code</p>
  
  <pre><code>var app = require('express')();
  var http = require('http').Server(app);
  var io = require('socket.io')(http);
  var usernames = {};
  
  app.get('/', function(req, res){
  res.sendfile('index.html');
  });
  http.listen(3000, function(){
  console.log('listening on *:3000');
  });
  
  io.on('connection', function (socket) {
  socket.on('adduser', function(username){
  socket.username = username;
  socket.broadcast.emit('updatechat', 'SERVER', username + ' has connected to  this room' + '&lt;hr&gt;');
  socket.emit('welcomeuser', 'SERVER Welcome', username  + '&lt;hr&gt;');
  
  });
  console.log('a user connected');
  socket.on('disconnect', function () {
  console.log('user disconected');
  });
  
   socket.on('chat-message', function (message) {
   console.log('message : ' + message.text);
   //excludes "socket" from getting the emit
   socket.broadcast.emit("chat-message",message);
   });
   });
  </code></pre>
  
  <p>and here is my client code </p>
  
  <pre><code>    var username = "";
      var socket = io();
  
      socket.on('connect', function(){
          socket.emit('adduser', prompt("What's your name?"));
      });
      socket.on('updatechat', function (username, data) {
          $('#chatlog-display-div').append('&lt;b&gt;'+username + ':&lt;/b&gt; ' + data + '&lt;br&gt;');
      });
      socket.on('welcomeuser', function(username, data){
          jQuery("#chatlog-display-div").append( username +'&lt;hr&gt;');
      });
       $('form').submit(function(e) {
       e.preventDefault();
  
             //gets the value from the message text feild and sets it as the    message var
       var message = {
              text : $('#chat-box-div-txtinpt').val()
              }
          if (message.text.trim().length !== 0) {
                          socket.emit('chat-message',message);
                  //append the message to the chatlog-display-div
                  $('#chat-box-div-txtinpt').focus().val('');
                  jQuery("#chatlog-display-div").append('&lt;div&gt;'+message.text+'&lt;/div&gt;&lt;hr&gt;');
                     }
      });
      //clear the value of the txtinput after you focus it.
  
             socket.on('chat-message', function (message) {
             jQuery("#chatlog-display-div").append('&lt;div&gt;'+message.text+'&lt;/div&gt;&lt;hr&gt;');
             });
  </code></pre>
  
  <p>can someone please help me</p>