cod*_*der 5 javascript websocket vue.js vuex vue-socket.io
import VueSocketIOExt from 'vue-socket.io-extended';
import { io } from 'socket.io-client';
const socket = io('http://localhost:3200/');
const socket1 = io('http://localhost:3100/');
Vue.use(VueSocketIOExt, socket);
Vue.use(VueSocketIOExt, socket1);
Run Code Online (Sandbox Code Playgroud)
我尝试使用上面的代码。但只有套接字在工作。是否可以同时连接两个插座。
kis*_*ssu -1
Vue.use(VueSocketIOExt, socket1)可能是压倒一切的Vue.use(VueSocketIOExt, socket),因此只有最后一个考虑到了IMO。
如果您尝试以下操作会怎样?
Vue.use(VueSocketIOExt, socket)
Vue.use(VueSocketIOExt2, socket1)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
97 次 |
| 最近记录: |