1.0.0 • Published 5 years ago
vue-stomp-simple v1.0.0
vue-simple-stomp
Vue stomp协议实时消息(未测试-不要使用)
Install
$ npm install sockjs-client
$ npm install stompjs
$ npm install vue-simple-stomp
Usage
Register the plugin, it will connect to /
import * as SockJS from 'sockjs-client'
import Stomp from 'stompjs'
import VueStomp from "vue-stomp";
Vue.use(VueStomp, {
url: '',
header: {
login: '',
passcode: '',
}
});
##Memo WM: WithMonitor
Use it in your components:
<script>
export default {
data () {
return {
stomp1: null,
stomp2: null
}
},
created(){
this.stomp1 = this.$stomp.subscribe('/user', callback)
this.stomp2 = this.$stomp.subscribe('/order', callback)
this.$stomp.send(this.stomp1, 'hello')
this.$stomp.send(this.stomp2, 'world')
this.$stomp.unsubscribe(this.stomp2, callback)
this.$stomp.disconnect(callback)
}
};
</script>
License
vue-stomp is available under the MIT license.
Contact
Copyright (C) 2016 FlySkyBear
1.0.0
5 years ago