Board Thread:General Coding Help/@comment-24473195-20141012080942

How does one  send a message when a new user connects?

I saw an explanation here(http://community.wikia.com/wiki/Thread:706763) but couldn't get it to work. Somehow the binding doesn't seem to work properly or there is something I missed: function sendToAll(msg) { //http://runescape.wikia.com/wiki/User:Joeytje50/chatmsg.js        mainRoom.sendMessage({             which: 13,             shiftKey: false,             preventDefault: function  {},             target: $(' ' + msg + ' ')         }); $('[name="message"]').removeAttr('disabled').focus; } function NewUserConnected(sData){ /// SendToAll('Wikian joined'); } mainRoom.socket.bind('join',NewUserConnected); 