websocket._exceptions.WebSocketConnectionClosedException: socket is already closed.
See original GitHub issueHi, I open the chrome browser and try to do anything after connecting to the dev tools, but anything I try results in ‘socket is already closed’…
Any suggestions?? (I have tried all of those lines and all of them end up throwing the socket closed error… chrome = PyChromeDevTools.ChromeInterface() - seems to be working fine.
subprocess.call(['open', '-a', "/Applications/Google Chrome.app", '--args', '--remote-debugging-port=9222'])
chrome = PyChromeDevTools.ChromeInterface()
chrome.Network.enable()
# chrome.Page.enable()
# chrome.Page.navigate(url="https://www.google.com")
# chrome.wait_event("Page.loadEventFired", timeout=60000)```
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Python Web Socket closes immediately after opening
WebSocketConnectionClosedException : Connection is already closed. Any idea why its closing right away? Edit: Ran with enableTrace true. Here is ...
Read more >WebSocket Error - Connection is already closed. - Qxf2 BLOG
I received this error when working on an application that involved a WebSocket connection. The Websocket handshake between the client and ...
Read more >FAQ — websocket-client 1.4.2 documentation
The WebSocketConnectionClosedException, which returns the message “Connection is already closed.”, occurs when a WebSocket function such as send() ...
Read more >Can't connect to websocket - Python Forum
I've spent some time now trying to connect to this websocket and I ... WebSocketConnectionClosedException: Connection is already closed.
Read more >WebSocket API "Connection is already closed" - Forum
I am testing yours WebSocket API from the provided example market_price.py downloaded from this site. I get following response "Connection ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@marty90 can you try and update so that
websocket-client==0.55.0which was release not too long ago to see if you can replicate the issue then?I restricted the version to
websocket-client==0.54.0and the error others are getting above disappeared. @nba94 @mylh can youse force install that version of websocket-client to see if youse can still replicate the issue?I had the same issue, whats happening is that when you create a new instance without specifying a timeout
chrome = PyChromeDevTools.ChromeInterface(), the timeout for the socket defaults to 1 second here, so basically the timeout you’re passing into wait_event is useless b/cmessage = self.ws.recv()times out within 1 second and raises an exception. To get around this specify a timeout when creating the ChromeInterface instance e.g.chrome = PyChromeDevTools.ChromeInterface(timeout=120), but now the timeout you pass into wait_event is only effective if its less than the socket timeout and there’s data coming in through the socket or else it will wait till the socket times out.So the timeout in wait_event essentially means wait for the passed in event to show up in incoming messages until we hit the timeout, if no data is coming in the socket will timeout within a second, unless specified when you initialize ChromeInterface.