Authenticate websocket clients using tokens?

﹥>﹥吖頭↗ 提交于 2019-12-06 04:49:15

What is wrong with cookies?

If both servers are in the same 2nd level domain (web.example.com and websocket.example.com), they can share cookies.

The websocket connection will send the existing cookies for that 2nd level domain during the negotiation.

So you can perform authentication in the web server, return an authentication cookie, and then the websocket will send that cookie to the server again. The websocket server should be able of opening and reading the cookie.

"500 messages per minute" are 8 messages per second, it should not be a problem. Websocket connections are established once, there is not a new connection per each message. A websocket is different than a webservice.

Cheers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!