-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering events before sending to a client #147
Comments
The standard way to handle this would be to have a channel per variable and subscribe each client to the channels of interest, and then use a channel manager to control access. Is there a reason this wouldn't work? Are there a lot of variables? |
I thought about this option, but the amount of variables depends on the use. |
Hmm, yes 50 channels per connection would be quite a lot. Currently there is a limit of 10. The main problem with lots of channels are amplification effects on other components, for example when using django-evenstream along with Pushpin chained to a message broker or something. However, if you are only using django-eventstream itself (as you would have to be for this validation function mechanism to work), then I think the effect would merely be a reasonable increase in memory usage within django-evenstream. In that case, 50+ channels per-connection is probably fine. Maybe even 1000 channels per-connection would be fine. What do you think about simply making the limit configurable and using more channels? |
On the client side, there is no effect to keep open 50 or more channels ? I think it is a better architecture approach to have a broadcast channel where all the devices can send new data and the web server is in charge of the message distribution. Why don't you like my proposition of a validation function per client ? |
Client awareness of channels is optional. Normal use of django-eventstream is for the server to select the channels, e.g.: urlpatterns = [
...
path('/events', include(django_eventstream.urls), {'channels': list_of_50_channels})
...
] The main reason I suggest trying to use channels is it can scale better if you grow to multiple server nodes, but maybe that's not a concern. I suppose the advantage of the broadcast channel is that it is more dynamic. You could grant a user access to an existing variable or start sending a new variable, and existing client connections could receive the data. Otherwise, clients would have to reconnect to get new channels assigned. I'm open to a PR to that lets the user provide a validation function (maybe call it a filter?). But it shouldn't go in |
seems reasonable |
Hello,
I am working on a SCADA software using django : PyScada.
I want to use SSE to send real time data and historic data to connected clients.
The system get data from various variables from connected devices.
The client need to get real time data from a list of variable.
Sometime a client is not allowed to get data from every variable and the server can decide to send him the data or not.
My idea of architecture is a broadcast channel where every device send the data of the read variables.
I need to have a filter function for each client allowing the server to decide if it send the data or not (depending on the client rights).
I was thinking to adding a
validation_function
tosse_encode_event
like this :And specify this function here and here.
The
event
function should pass this to thestream
function inutils
.What do you think about this ? Do you have a better solution ?
The text was updated successfully, but these errors were encountered: