WebSocket emulation - Javascript client