What are the common pitfalls or challenges faced when using Websockets with PHP, especially in conjunction with Plesk and NGINX Proxy?

One common challenge when using Websockets with PHP, especially in conjunction with Plesk and NGINX Proxy, is that NGINX may not be properly configured to handle WebSocket connections. To solve this, you need to update your NGINX configuration to allow WebSocket connections by adding the appropriate proxy headers.

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}