Sobes.tech
Junior — Senior

Efficient server event processing model

livecode

Task condition

There is an abstraction of a connection to a server, through which the server transmits a stream of events in the form of JSON messages. Different modules of the application subscribe to specific types of events. It is required to design and implement an efficient mechanism that allows different parts of the system to receive only the events they are interested in, minimize overhead, and provide a convenient way to subscribe/unsubscribe.

interface ServerConnection {

    // Emits events in JSON format
    fun event(): Flow<String>
}