Solve the problem that socket.io cannot use websocket long connection and keeps polling for requests

2022-06-06-19-09-04%E5%B1%8F%E5%B9%95%E6

Reference: https://ift.tt/cnvFQjq

Possible explanations:

Proxy in front of server not accepting WebSocket connections

Please see the documentation here .

On the Nginx proxy, modify the nginx configuration

as follows.

 http {     server {       listen 80;       server_name example.com;          location / {         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_set_header Host $host;            proxy_pass http://localhost:3000;            proxy_http_version 1.1;         proxy_set_header Upgrade $http_upgrade;         proxy_set_header Connection

The post addressing socket.io not being able to use websocket long connections and always polling for requests first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8615
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment