move socket sending and error emitting to nextTick to allow error handler setup
Merge pull request #4 from bmeck/master

move socket sending and error emitting to nextTick