I don't use `send(encode(_queue))` , because if some data was added to the `_queue` between sending and clearing it, those would not ever be sent. Therefore I create new List `dataToSend`, where I specify the items to be send and exactly those items from the list are deleted from `_queue`. Reason, why I don't use `_queue.clear()` , is that some items might have been added to the `_queue` after I created the `dataToSend`