Improve APIs for WebSocket and SockJS messages