wstomp-vue
v0.0.4
Published
Downloads
8
Readme
wcommon-vue
1.使用
安装
npm install wstomp-vue -S
需要的其他依赖
npm install stompjs -S
npm install sockjs -S
npm install sockjs-client -S
main.js
import wstompVue from "wstomp-vue";
Vue.prototype.$common = wstompVue.utils;
.vue页面使用
//stomp连接
let wsUrl="ws://localhost:61614/stomp"; //stomp地址
// let headers={login:'username',passcode:"password"}; //参数用户名密码
let headers={};
let topic =["/test","device"] //订阅topic
this.$common.connect(wsUrl,headers,topic,(topic,msg)=>{
console.log("msg",msg)
if(topic=='/test'){
}
})
//stomp 发送消息
let data ={
topic:"device", //topic
param:{},
msg:JSON.stringify({name:1111}) //传参
}
this.$common.sendMessage(data)
2.版本相关
版本0.0.1
//初始版本
版本0.0.2
//修改README.md
版本0.0.3
//修改README.md