Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The websocket of zombie. #256

Open
laiyazhou opened this issue Dec 27, 2018 · 0 comments
Open

The websocket of zombie. #256

laiyazhou opened this issue Dec 27, 2018 · 0 comments

Comments

@laiyazhou
Copy link

from ws4py.client.threadedclient import WebSocketClient

class Client(WebSocketClient):

    def opened(self):
        print("Open")

    def closed(self, code, reason=None):
        print("Closed down:", code, reason)

    def received_message(self, resp):
        data = json.loads(str(resp))
        print(data)

if __name__ == '__main__':
    ws = None
    count = 0
    while True:
        try:
            ws = Client('wss://xxxxxxxxx:xxxxxxxxx')
            ws.connect()
            ws.run_forever()
        except KeyboardInterrupt:
            ws.close()
            break
        except Exception as e:
            continue

Like above of code.
when i run the code,after a while,it wont't receive any messages,and it won't TimeoutError,as if the program has frozen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant