added websocket test code
This commit is contained in:
@@ -45,9 +45,7 @@
|
||||
},
|
||||
sendWsMessage(msg) {
|
||||
console.log("sending msg: " + msg);
|
||||
this.$socket.client.emit('my_event', msg, (resp) => {
|
||||
console.log(resp);
|
||||
});
|
||||
this.$socket.client.emit('my_event', msg);
|
||||
},
|
||||
connectWebsocket() {
|
||||
this.$socket.client.connect();
|
||||
@@ -63,11 +61,15 @@
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$socket.client.on('my_event', (msg) => {
|
||||
this.$socket.client.on('my_response', function(msg) {
|
||||
console.log(msg);
|
||||
});
|
||||
this.$socket.client.on('connect', (msg) => {
|
||||
console.log("connected");
|
||||
this.$socket.client.on('server_event', function(msg) {
|
||||
console.log("get server_event:");
|
||||
console.log(msg);
|
||||
});
|
||||
this.$socket.client.on('connect', function(msg) {
|
||||
console.log("We are connected!");
|
||||
console.log(msg);
|
||||
});
|
||||
|
||||
|
||||
@@ -72,7 +72,9 @@ Vue.use(VueSweetalert2);
|
||||
Vue.use(VeeValidate);
|
||||
Vue.use(VueMoment);
|
||||
|
||||
const socket = io('ws://localhost:5000');
|
||||
const socket = io('ws://localhost:5000',);
|
||||
console.log(socket.nsp);
|
||||
|
||||
|
||||
Vue.use(VueSocketIOExt, socket);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user