Fixes#919.
Fixes bugs for new webserver:
- Unhandled exception when closing already closed websocket
- No pings for plain websocket connection
- Server drops websocket connection when client responds to pings but
doesn't send anything
Also changing API of ng connections. Now timeout is set by a separate
method instead of providing it for each call.