How do I know the status of chrome.experimental.socket?
-
18-06-2021 - |
Question
When I use "chrome.experimental.socket API" on chrome-extension, how do I know the socket had been disconnected or, is disconnected just now. I'm use Canary-Chrome.
Solution
I've just made a change which adds a getInfo call to the socket API, which includes the connected/disconnected state.
However it's worth noting that a socket may remain 'connected' even if say, the remote end has dropped the connection; after this kind of drop, a read() will return an error/EOF.
OTHER TIPS
Getting the state of a socket is currently not possible with the API. I have filed a Chromium feature request for this.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow