Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.14k stars 381 forks source link

Fixed message validation for Python 3 #31

Closed mmxmb closed 6 years ago

mmxmb commented 6 years ago

Added short-circuit that prevents checking if message is unicode, if Python version is 3.0 or higher. There is no unicode keyword in Python 3 since all strings are sequences of Unicode characters.

Discovered this when trying to pass a msg of type dict to send_message(self, client, msg). Results in NameError: name 'unicode' is not defined when using Python 3.6.1.

Pithikos commented 6 years ago

Thanks for the PR. Appreciated!