I found I had to decode the "raw_path" bytestring, because django internals (v. 3.1.2) indiscriminately type cast paths using str(), with the Very Bad Result that b"/ws/" converts to "b'/ws/'"
match=resolve(scope["raw_path"].decode("utf-8"))
...And once I thought to look, I see both of these were noted in the original post on medium.com by comments there. Ah well.
in index.hml:
Might be fun to add a message handler to the script tag:
Very useful, thank you. A couple of notes:
in
websocket/middleware.py
:"raw_path"
bytestring, because django internals (v. 3.1.2) indiscriminately type cast paths using str(), with the Very Bad Result that b"/ws/" converts to "b'/ws/'"...And once I thought to look, I see both of these were noted in the original post on medium.com by comments there. Ah well.
in
index.hml
: