Get Even More Visitors To Your Blog, Upgrade To A Business Listing >> not firing events from client to server not firing events from client to server


Why doesn't my Server respond to an emitted event by the client? I have tried a few trivial examples from the webpage and they seem to be working fine.

My goal is to emit an event whenever a user focuses out from the input box, compare the input value on the server, and fire an event back to the client.


$('#userEmail').focusout(function() {
  var value = $('#userEmail').val(); // gets email from the input field
  console.log(value); // prints to console (it works!)
  socket.emit('emailFocusOut', { userEmail: value }); // server doesn't respond to this


io.sockets.on 'emailFocusOut', (data) ->

Additional info

  • express 3.0rc4
  • 0.9.10
  • coffee-script 1.3.3
Problem courtesy of: Sahat Yalkabov


If you need some answer from server your server should emit message back to client.
console.log does not do network answer.

var io = require('').listen(80);

io.sockets.on('connection', function(socket) {
    socket.on('emailFocusOut', function(data) {
        data.receivedAt =;
        socket.emit('emailFocusOutResponse', data); // answer back

Then on client you can listen for 'emailFocusOutResponse' and handle this message.

Solution courtesy of: Eugene Naydenov


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post not firing events from client to server


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription