WebRocket enhancements

Manually merged our WebRocket codebase to dev2 so features get also here to the open source repo. We haven't yet had the time to move to using `WebTundra/dev2` as a base for WebRocket, so I'll have to do manual merges until then.

I also merged the work I did on this repo to WebRocket so they are being kept in good sync even if are not the same repo.

Various bug fixes and enhancements, the diff is not that long to read through :)