python-websocket-server icon indicating copy to clipboard operation
python-websocket-server copied to clipboard

UnicodeDecodeError

Open 2t6h opened this issue 6 years ago • 5 comments

message = self.request.recv(1024).decode().strip() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 4: invalid start byte

2t6h avatar Sep 03 '18 20:09 2t6h

Yea I have the same problem

Laura055 avatar Oct 20 '18 20:10 Laura055

+1, also running into this

adeora avatar Dec 14 '18 19:12 adeora

This appears due to trying to utilize an SSL on the server. I received the same message. Have you guys found a way around this? Are you also utilizing nginx in your projects?

When attempting a proxy_pass, I then receive a new error:

Traceback (most recent call last):
  File "/usr/lib/python3.6/socketserver.py", line 721, in __init__
    self.handle()
  File "/home/damian/hopemud/websocket_server/websocket_server.py", line 199, in handle
    self.handshake()
  File "/home/damian/hopemud/websocket_server/websocket_server.py", line 337, in handshake
    assert headers['upgrade'].lower() == 'websocket'
KeyError: 'upgrade'

Jawmo avatar Mar 24 '19 05:03 Jawmo

I had the same error I have proxied the websocket through apache, that manages ssl , with the following in VirtualHost (the websocket server runs on port 13100)

<VirtualHost :443> ... RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule . ws://yourserver.com:13100%{REQUEST_URI} [P] ...

and my client simply connects to
wss://yourserver.com

atrebbi avatar Oct 06 '19 10:10 atrebbi

I accidentally tried to connect through 'wss' to my local server, which hadn't any certificates and that was causing this error. Changing to 'ws' protocol resolved this

Alveona avatar Dec 04 '19 09:12 Alveona