5
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);

我尝试使用上面的代码。但只有套接字在工作。是否可以同时连接两个插座。

4

1 回答 1

-1

Vue.use(VueSocketIOExt, socket1)可能是压倒一切Vue.use(VueSocketIOExt, socket)的,因此只有最后一个考虑到 IMO。

如果您尝试以下方法怎么办?

Vue.use(VueSocketIOExt, socket)
Vue.use(VueSocketIOExt2, socket1)
于 2021-06-21T07:56:13.980 回答