Re: Channels: Using `allowed_hosts_only` with `WebsocketDemultiplexer`

2017-09-25 Thread Andrew Godwin
It's pretty tough right now to use the decorators with the classes (this is why things like http_user are built-in) - you have to wrap them around the handle method, if I remember correctly. I'm hoping to fix this with the design of Channels 2 by changing the way classes get called, but that's not

Channels: Using `allowed_hosts_only` with `WebsocketDemultiplexer`

2017-09-25 Thread Michael Huang
Hi there. I couldn't figure out how to use the allowed_hosts_only decorator with the connect method of WebsocketDemulitplexer. I ended up copying and pasting the relevant code into a mixin I could use directly with WebsocketDemultiplexer (removing __init__ and __call__, adding a connect method