Websockets token authentication using middleware and express in node.js

后端 未结 2 1629
臣服心动
臣服心动 2021-01-24 02:12

I use node.js, express and express-ws that is based on ws

Express-ws allows to create express-like endpoints for websockets.

I am looking for a solution to auth

2条回答
  •  终归单人心
    2021-01-24 02:40

    On your client side, you should pass an array of strings instead of object, but you must set a header for your HTTP response with a key and value:

    key : headeSec-WebSocket-Protocol
    value : corresponding protocol used in front.
    

提交回复
热议问题