Answer the question
In order to leave comments, you need to log in
What is the best way to collect data from several streams, for subsequent sending to the client?
There are about 40 functions divided logically into packages, each package works in a separate thread, and a web server for GUI implementation (a simple client on a web socket) also works in a separate thread. The functions are very simple - for working with the file system (checking the existence of files, copying files, renaming, etc.).
The problem is that each function passes a lot of different types of information to the client. Now the transfer is implemented as a crutch from a large structure, which is filled by a timer with data from each function and then sent to the client.
Most likely, there are some ready-made solutions or patterns for this task. But unfortunately I can not find solutions yet, maybe someone solved a similar problem?
Answer the question
In order to leave comments, you need to log in
Why bother with Go if you don't understand its basic "share by communication" paradigm?
You here, from what I understand, definitely need channels. Because there are many threads + one structure + filling by timer, it makes you think that a complete mess is going on.
Describe the problem better.
Now the transfer is implemented as a crutch from a large structure, which is filled by a timer with data from each function and then sent to the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question