I know that it's supposed to take the text and send it to each socket but I'm not sure as to what each line does.
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
$(function () {
var socket = io();
$('form').submit(function(){
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
});
I'd say this code is a little incorrect since it would trigger on any form submission - if you had multiple forms you would end up in trouble :)