I have a process that is basically part of a long survey implementation. In short, the client makes a request to the server, which then creates a channel and returns it to that client. The channel will contain the information requested by the client. Since this is intended for a lengthy survey, the information that the client requested may change. If the information changes, the server will record the update on the channel, and, theoretically, the client can capture the update and reflect this.
The problem I am facing is that it is likely that I will end up with a lot of channels, which can lead to unnecessary processing during the upgrade. I can potentially update channels where the client no longer cares.
My solution was that as soon as the client stops caring about this information, it closes the channel, which somehow notifies the server about it and does not allow the server to perform additional processing and updates.
How can the server know if the channel is closed? In this case, the server is essentially a writer and does not read anything from the channel. In addition, all recording methods are wrapped in a go block, so it always returns a channel (I do not see nil). Is there a way to do this, or is my approach completely disabled?
thank
source
share