Why node.js requires an upgrade while trying to run an application on the localhost?

前端 未结 4 758
梦毁少年i
梦毁少年i 2020-12-20 11:53

When I try to run my node.js application on a localhost server, it does not run and demands a required upgrade. I have tried to run the code but I get the following error:

4条回答
  •  被撕碎了的回忆
    2020-12-20 12:54

    Upgrade Required is a reference to the header that is sent when establishing a WebSocket connection between a client (i.e. the browser) and the server.

    Like @Prinzhorn stated in his comment, you need a client application that connects to your WebSockets server, which could be a static html page. I recommend you reading this introduction to websockets to understand better how WebSockets work.

提交回复
热议问题