How to hit the WebSocket Endpoint?

后端 未结 6 1228
梦如初夏
梦如初夏 2021-02-05 22:52

I see that there is websocket endpoint which works out fins with Java tests. In logs I see

Connecting to: ws://127.0.0.1:8080/76f48a44-0af8-444c-ba97-3f1ed34af         


        
6条回答
  •  醉酒成梦
    2021-02-05 23:12

    I had to use this command to make it work:

    $ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: echo.websocket.org" -H "Origin: http://www.websocket.org" -H "Sec-WebSocket-Version: 13" -H 'Sec-WebSocket-Key: +onQ3ZxjWlkNa0na6ydhNg==' http://www.websocket.org
    

    I am using Jetty, and if I didn't add the Sec-WebSocket-Version/Sec-WebSocket-Key doesn't work. Just for the record.

提交回复
热议问题