Draymond
Draymond

Reputation: 31

Using websocket for python web crawler -- rsv is not implemented, yet

I use websocket to make a long-live connection with the target wss-url successfully. But after receiving one message, the code caught an error named "rsv is not implemented, yet" and closed the connection.

It seems that few people have met this problem, which described as "rsv is not implemented, yet". And the API doc of websocket never mention this issue.

The main piece of my code:

def on_message(ws, message):
    print(message)

def on_error(ws, error):
    print("!!!find error!!!")
    print(error)

def on_close(ws):
    print("### why closed ???###")

websocket.enableTrace(True)
ws = websocket.WebSocketApp(url, 
                on_message = on_message, 
                on_error = on_error, 
                on_close = on_close, 
                header = header, 
                cookie = cookie,
            )
ws.run_forever(origin = 'https://matters.news', skip_utf8_validation = True)

It will give me only one message, and then show that:

!!!find error!!!
rsv is not implemented, yet
send: b'\x88\x82\xd9\xe2\xcc\x8c\xda\n'
### why closed ???###

Upvotes: 3

Views: 2398

Answers (1)

Coco
Coco

Reputation: 906

I received the same error and fixed it by removing:

'Sec-WebSocket-Extensions': 'permessage-deflate'

from my headers.

Upvotes: 3

Related Questions