nodetuts-coffeescript
nodetuts-coffeescript copied to clipboard
005-breaks on exit
If you have multiple users connected then quitting the terminal breaks the server
net.js:391
throw new Error('Socket is not writable');
^
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at Carrier.<anonymous> (/Users/matthew/Projects/Node/nodetuts-coffeescript/coffee_files/005_chat.coffee:31:38)
at Carrier.emit (events.js:64:17)
at Socket.<anonymous> (/Users/matthew/Projects/Node/nodetuts-coffeescript/coffee_files/node_modules/carrier/lib/carrier.js:50:12)
at Socket.emit (events.js:61:17)
at Socket._onReadable (net.js:658:51)
at IOWatcher.onReadable [as callback] (net.js:177:10)
seems it tries to run the for one_connection in connections one_connection.write("#{username}: #{line}\n") line before it calls the "close" command
I guess there needs to be a rescue