I wanted to open a discussion on facility management in this app. Essentially I see some limitations in how this app can be useful for more than 1 type of websocket unless all the application logic sits on the client side (javascript) code. More to the point:
It's not documented how to restrict allowed facilities.
It's not terribly easy to allow or restrict channels based on the facility being called.
There is no way on the server side to hook into a received message, or other important events such as connected and closed (maybe even publish).
The final bullet point being my biggest motivation here. I read a bit where other users of this app hinted at this limitation and were quickly met with a response such as you shouldn't need to do that; hinting because concurrent Python code is tricky, and most server-side logic will be blocking calls and thats bad for websockets running on gevent. I agree concurrent Python code is tricky, and I admit I do not fully understand it myself. But I also think this app shouldn't hard-prevent us from add anything in (even though we may shoot ourselves in the foot).
I'd like to propose the following; and I'm totally willing to contribute the code, but I also somewhat fear this is a big change to the core values you had when writing this app and the contribution may be faced with opposition (hence this discussion).
Make a Facility class, having it be more than the simple string it is currently.
This would look much like the ws4redis class on the javascript side, but on the server, containing the functions on_open, on_close, on_message. The BaseFacility class would define these functions, but they will be empty.
Add hooks from the RedisSubscriber/RedisStore into the defined facility class where applicable.
Define allowed_channels per facility rather than a global list. Right now it seems quite messy to allow more than 1 type of facility (especially if we want basic server side logic).
In settings we could define a list WS4REDIS_FACILITIES much like context processes or installed apps.
A quick code example to show what I was thinking..
I wanted to open a discussion on facility management in this app. Essentially I see some limitations in how this app can be useful for more than 1 type of websocket unless all the application logic sits on the client side (javascript) code. More to the point:
The final bullet point being my biggest motivation here. I read a bit where other users of this app hinted at this limitation and were quickly met with a response such as you shouldn't need to do that; hinting because concurrent Python code is tricky, and most server-side logic will be blocking calls and thats bad for websockets running on gevent. I agree concurrent Python code is tricky, and I admit I do not fully understand it myself. But I also think this app shouldn't hard-prevent us from add anything in (even though we may shoot ourselves in the foot).
I'd like to propose the following; and I'm totally willing to contribute the code, but I also somewhat fear this is a big change to the core values you had when writing this app and the contribution may be faced with opposition (hence this discussion).
A quick code example to show what I was thinking..