socket emits to different socket than it received from

If i do something like

socket.on('herp', function(derp){ socket.emit('derp', derp); }

The message goes to a different socket than the one that sent the original message

This is how i intend to pass messages for a javascript multiplayer pig (dice game) tutorial i'm trying to put together

the structure of the app is as follows pig_server: https://github.com/hayksaakian/pig_server manages accounts/players and games, rolls dice, relays actions pig: https://github.com/hayksaakian/pig manages ui, client side; emits actions

How to recreate problem: first do node helloworld.js to run the server

from two different web browsers open pig/www/index.html (from the client directory)

in each browser: create an account, click ladder, click find game. Once the game shows up on each browser, click on it from the ladder page's list.

in the javascript console: socket.emit('herp', 'derp'); (do this from both browsers)

two new messages should show up in just one browser