0

I follow this tutorial to build a chat system

https://channels.readthedocs.io/en/stable/tutorial/part_1.html

It works fine when the room name is a string without white spaces, say "Room1".

WebSocket HANDSHAKING /ws/chat/Room1/

WebSocket CONNECT /ws/chat/Room1/

However, when I change the room name to "Room 1", it results in

WebSocket HANDSHAKING /ws/chat/Room%201/ [127.0.0.1:59947]

Exception inside application: No route found for path 'ws/chat/Room 1/'.

ValueError: No route found for path 'ws/chat/Room 1/'.

I have tried to change the roomname by replacing the white space with "%20" in the HTML, routing.py and consumers.py. None of them works. How can I solve this problem?

  • You can not using path with whitespace. you using suitable characters instead. – NEBEZ Jul 31 '21 at 04:26
  • I don't recommend having whitespace in your path. If you realy need, you need to URL encode it https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 – Nikita Tonkoskur Aug 03 '21 at 21:00

0 Answers0