为什么 websocket 可以关闭连接?
Why websocket can close connection?
使用Ratchet/React.
如果我的连接数少于 1000 个,它工作正常,但是当连接数增加时 - websockets 在连接后自动关闭。
这是什么原因?
cat /proc/sys/fs/file-nr
5696 0 815941
open files (-n) 16384
cat /proc/sys/fs/file-max
815941
On socketo.me this is adressed in the Deployment tab.
A Unix philosophy is "everything is a file". This means each user connecting to your WebSocket application is represented as a file somewhere. A security feature of every Unix based OS is to limit the number of file descriptors one running application may have open at a time. On many systems this default is 1024. This would mean if you had 1024 users currently connected to your WebSocket server anyone else attempting to connect would fail to do so.
他们还建议更改次要配置以允许更多连接。如果问题没有解决,您可以尝试使用 libevent 或禁用 XDebug,尽管这可能不是必需的。
使用Ratchet/React.
如果我的连接数少于 1000 个,它工作正常,但是当连接数增加时 - websockets 在连接后自动关闭。
这是什么原因?
cat /proc/sys/fs/file-nr
5696 0 815941
open files (-n) 16384
cat /proc/sys/fs/file-max
815941
On socketo.me this is adressed in the Deployment tab.
A Unix philosophy is "everything is a file". This means each user connecting to your WebSocket application is represented as a file somewhere. A security feature of every Unix based OS is to limit the number of file descriptors one running application may have open at a time. On many systems this default is 1024. This would mean if you had 1024 users currently connected to your WebSocket server anyone else attempting to connect would fail to do so.
他们还建议更改次要配置以允许更多连接。如果问题没有解决,您可以尝试使用 libevent 或禁用 XDebug,尽管这可能不是必需的。