Improvements to WebSockets API