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