virattara virattara - 2 years ago 235
Node.js Question client not receiving message event

My project's skeleton is of express-generator thus used this workaround:here


io.on('connection', function(socket){
socket.on('message', function(msg){
io.emit('message', msg);

CLIENT:(src for socket included)

var socket = io.connect('//localhost:5000');

function op(){
socket.emit('message', $('input[name=yolo]:checked', '#myForm').val());

socket.on('message', function(msg){


form(action='' id="myForm")
///form inputs
input(type="submit" value="book" onclick="op()")

  1. Connection is made on both sides verified.

  2. Message is received by the server but it isn't emitting it for the client side socket.on('message'... to trigger.

  3. Tested every step only the last socket.on('message'.. not triggering.

Answer Source

Found the problem. I was using Firefox and it's just not working with shifted to chrome and everything is working fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download