How to deal with vue using native websocket in vuex

new WebSocket in main.js and then inject it into store
clipboard.png
action _this.$socket.onopen
clipboard.png

_this.$socket.onopen
console.log("open1")
console.log("open")

clipboard.png
to solve puzzles

May.25,2022

you have already started and connected successfully when you new. What's the use of listening behind you


just do the manual work and put the onopen in the main.js.

store.$socket.onopen = function(){
  setInterval(function(){
    store.$socket.send('{"type":"ping"}')
  },3000);
};

encapsulates a class, or you can refer to https://juejin.im/post/5bcad1...


can this be called and updated in all sub-pages?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdca00-312ef.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdca00-312ef.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?