But I was more than one page introduces the components, need to establish a separately for each component and the background of connection, so I deleted global Vue. Ues, written in component
& lt; Script>
The import Vue from "Vue";
The import VueSocketIO from "vue - socket. IO";
The import SocketIO from "socket. IO - client";
Vue. Use (
New VueSocketIO ({
The debug: true,
Connection: SocketIO (" http://127.0.0.1:5000 "),
})
);
Export the default {
Name: "ZuJian,"
Sockets: {
Connect: the function () {
The console. The log (enclosing $socket);
The console. The log (" client connent socket. The id="+ enclosing $socket. Id);
},
}
Print found each component in this. $socket. Same id, the equivalent of multiple components with the background or a connection,
I want every component, is a separate connection, the mutual interference of returned by processing the background data, should be how to write?