Do not write if the websocket is not open.
Removed useless callback
Merge pull request #24 from mcollina/handle-write-errors

Do not write if the websocket is not open.