wesocket
v1.0.10
Published
wesocket
Downloads
10
Readme
WeSocket
项目介绍
简化Socketjs-client 与 stompjs 操作
使用说明
import WeSocket from 'WeSocket';
let socket = new WeSocket();
//let gv = new WeSocket.Gv(user);
socket = new WeSocket("protocol://hostname:port/websocket", user);
socket.on("connected", frame => {
console.log("connected", this, frame);
}).on("close", () => {
console.log("close", this);
}).on("error", error => {
console.log("error", this, error);
}).on(["broadcast", "notice", "group", "role"], (evt, msg, id) => {
switch (evt) {
case 'chat':
case 'join':
case 'leave':
append(msg);
break;
default:
break;
}
}).connect({
ready: () => {
console.log("ready !!!!");
},
reconnect: true,
debug: false
});