Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
クライアントがいつ切断されたかをサーバーに知らせたい。したがって、ロングポーリングを実装したいと考えています。問題は、ループの単純な解決策は多くのリソースを消費することですが、私はより良い方法を知りません。
WebSocket を避けたい場合の解決策は次のとおりです。
2 秒ごとに一意の ID でクライアントに example.php を ping させます。
example.php はこれを行います: