"stack": "Error: Failed to execute 'send' on' WebSocket':"

what is the reason for reporting this error when using WebSocket? I use it in paging. Every time I turn the page, I will close the connection, then open the connection again and send a message, but I will report this error every time I turn the page. How should I solve it? Thank you

{ "stack": "Error: Failed to execute "send" on "WebSocket": Still in CONNECTING state.\n at http://db.vivo.xyz/dbaplat-info/static/js/3.41ae162b1bf12cefca39.js:1:7816" }
Jan.14,2022

several status values of websocket:

The

CONNECTING: value is 0, which indicates that the connection is in progress; the
OPEN: value is 1, which means the connection is successful and ready to communicate; the
CLOSING: value is 2, which indicates that the connection is being closed; and the
CLOSED: value is 3, which indicates that the connection is closed or failed to open the connection

.

normal send sending can only be done when the value is 1, so adding a status judgment before send can solve the problem

if (socket.readyState===1) {
    socket.send(JSON.stringify(message));
}

send cannot be called until after the onopen event of websocket.
this error message has already told you, "still in connection"


is there no jump to turn the page on this page

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-1b3048e-2b065.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-1b3048e-2b065.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?