Problems with Vue-Socket.io being used only in one of the subcomponents of vue

use vue-socket-io: globally

import VueSocketio from "vue-socket.io";
Vue.use(VueSocketio, "http://socketserver.com:1923");

there is a problem, that is, no matter where the current page is, socket is set up. Once the connection goes wrong, the page will always reconnect the request. Now I don"t know how to use socket, only on a page.

Mar.22,2021
To set up and destroy the

component cycle, you still need to see the vue-socket.io document


vue using socket.io to solve the problem of reconnection.

Menu