New in Socket.io, How to prevent Socket.io client script hacking
<p>I'm new in Socket.IO, and I've just implemented the tutorial instruction about Socket.IO at <a href="http://socket.io/get-started/chat/" rel="nofollow">http://socket.io/get-started/chat/</a>. It's quite interesting.</p>

<p>But now I have a concern about security.
The client code for sending message is: </p>

<pre><code>&lt;script&gt;
  var socket = io();
  $('form').submit(function(){
    socket.emit('chat message', $('#m').val());
    $('#m').val('');
    return false;
  });
  socket.on('chat message', function(msg){
    $('#messages').append($('&lt;li&gt;').text(msg));
  });
&lt;/script&gt;
</code></pre>

<p>The function call socket.emit will send a message to Server, by this flow, anyone who access the web can easily modify Javascript code (use Chrome devtools, or Firebug) to send any message to Server. </p>

<p>For example, user can add the code lines as following:</p>

<pre><code>&lt;script&gt;
   $(document).load(function() {
       socket.emit('chat message', '1122');
       socket.emit('get_users', null);
       socket.emit('delete_user', 1);        // What ever he wants
   });
&lt;/script&gt;
</code></pre>

<p>This hack may cause harmful to system.  </p>

<p>My question is, how to prevent user from modifying Javascript code and making a manual call to socket.io server, including users who have right to log in web application.</p>

<p>Any help would be great appreciated!</p>