2.2. Event processing

Because the library is realtime, no function may ever block the execution. Therefore all functions return immediately, either with an immediate result available, or scheduling the operation for background execution.

Events are delivered to a user defined callback function called event dispatcher. The connection that the event is delivered for is blocked for write operations during the time of dispatcher's execution. This means that all requests to write to the connection are scheduled, but the actual writing will start as soon as the event dispatcher finishes executing and returns control to the library. (This is done to optimize network performance when large amounts of small data portions are written.)