Closed scse-l closed 1 year ago
Typically, the server shouldn't need to care about the presence of connections. It simply generates events and if anyone is listening then they get the events. It is the client that decides whether it cares about listening. The most straightforward way to close an unneeded channel is from the client side.
That said, it is also possible to close connections from the server side, by using channel permissions. You could create a ChannelManager
with a can_read_channel
method that returns False
for channels that will never have any more events. Then you could use channel_permission_changed
to close connections.
Typically, the server shouldn't need to care about the presence of connections. It simply generates events and if anyone is listening then they get the events. It is the client that decides whether it cares about listening. The most straightforward way to close an unneeded channel is from the client side.
That said, it is also possible to close connections from the server side, by using channel permissions. You could create a
ChannelManager
with acan_read_channel
method that returnsFalse
for channels that will never have any more events. Then you could usechannel_permission_changed
to close connections.
Thanks for the reply! It's really helpful!
I use format-channels for requests. If all data are sent, do I need close the channel? And how?