Tidy up exception handling.  Fixes a source of socket handle leaks.
Gcc build fix
Fix assert in websocket eventing