socket.io - 无法接收 SocketIO 客户端的“auth”参数
问题描述
这就是我访问 SocketIO 服务器的方式
var socket = io('http://localhost:3001', {
query: {
token : "XXXX"
},
withCredentials: false,
allowEIO3: true,
auth: {
token: "abc"
}
});
在后端我得到query
但不是auth
参数:
{"headers":{"host":"localhost:3001","user-agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0","accept":"*/*","accept-language":"en-US,en;q=0.5","accept-encoding":"gzip, deflate","origin":"http://localhost:4001","dnt":"1","connection":"keep-alive","referer":"http://localhost:4001/","sec-gpc":"1"},"time":"Tue Jun 01 2021 22:29:48 GMT+0530 (India Standard Time)","address":"::ffff:127.0.0.1","xdomain":true,"secure":false,"issued":1622566788895,"url":"/socket.io/?token=XXXX&EIO=3&transport=polling&t=Nd8X5xy","query":{"token":"XXXX","EIO":"3","transport":"polling","t":"Nd8X5xy"}}
解决方案
推荐阅读
- java - “'StoredProcController' 中构造函数的参数 0 需要一个名为 'oracleEntityManager' 的 bean,但无法找到”Spring Boot 应用程序
- python - 图表类:TypeError:__init__() 接受 1 个位置参数,但给出了 3 个
- r - 使用ggplot2在一定半径内绘制点之间的路径
- laravel - Laravel 8 为第三方发布 api
- python - 在 python 中使用 selenium 显示鼠标光标的方法
- ruby-on-rails - 为什么开发中的清洗会影响生产?
- python - 如何选择数据库的列以在 sklearn 中调用线性回归(OLS 和套索)
- python - 在 python 2.7.9 上安装 nltk 库它不起作用
- r - 使用 R 中读取的 CSV 文件中的列数据
- javascript - 如何检查数组索引是否不等于参数?