var websocket_url='ws://127.0.0.1:8888';
var websocket=new WebSocket(websocket_url);

websocket.onopen=function (event) {
console.log('connecte swoole websocket success');
};

websocket.onmessage=function (event) {
console.log('websocket server return message : '+event.data);
};

websocket.onclose=function (event) {
console.log('client close');
};

websocket.onerror=function (event,e) {
console.log('error '+event.data);
};