Open saxtorinc opened 4 years ago
I met the same problem, who can solve it?
I found out that this problem might require proxy.
self.activeWs = websocket.WebSocketApp("wss://web.whatsapp.com/ws", on_message = lambda ws, message: self.onMessage(ws, message), on_error = lambda ws, error: self.onError(ws, error), on_open = lambda ws: self.onOpen(ws), on_close = lambda ws: self.onClose(ws), header = { "Origin: https://web.whatsapp.com" });
**self.activeWs.run_forever(http_proxy_host="127.0.0.1", http_proxy_port=1087);**
self.websocketThread = Thread(target = self.activeWs.run_forever);
self.websocketThread.daemon = True;
self.websocketThread.start();
[1] Message after login: 1585527026,["Cmd",{"type":"update"}] [1] Traceback (most recent call last): [1] File "/app/backend/whatsapp.py", line 149, in onMessage [1] self.loginInfo["serverRef"] = json.loads(messageContent)["ref"]; [1] TypeError: list indices must be integers, not str [1] [1] send: '\x88\x82\xb6\xb9a\xe5\xb5Q' [1] sending {"type": "resource_gone", "resource": "whatsapp", "resource_instance_id": "10a70c37576a412999bd9c5ca2325467", "from": "backend"} [1] WhatsApp backend Websocket closed. [0] got message { [0] type: 'resource_gone', [0] resource: 'whatsapp', [0] resource_instance_id: '10a70c37576a412999bd9c5ca2325467', [0] from: 'backend' [0] }