Questions about swoole sessions

 var token = localStorage.getItem("userToken");
    if(!token){
            alert("");
       return false;
  }

  var ws = new WebSocket("ws://127.0.0.1:8081");

when ws.onopen, I intend to send token to the server for verification, but it seems that ws.send () can only wear one value,

var data = {
token:token,
data:// 
};

ws.send(data);

if this is passed, the backend gets the following: "{" receive from ": 4," data ":" [object Object] "}",

is there any way to pass a value to get it in the background and do token verification?
or can you add token to header when send


can completely change the way of thinking. First of all, the network can only transmit stream data, which cannot be changed. There are many ways to send objects in the form of strings in a specific format. For example, the JSON and FORM, backend are taken out and then parsed into the corresponding types

encapsulates a function
ws.sendObject = function (data) {

return ws.send(JSON.stringify(data));

};


var ws = new WebSocket ("ws://127.0.0.1:8081?token= {token}");


I suddenly have an idea, that is, write token and fd bindings to redis/mysql, to query according to fd when requesting, but users create a fd, every time they open a window, so this seems to be undesirable?


same question!

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