13.11.2020, 12:40
There's no documentation because localbus is not needed for most users.
If you want to correctly communicate with multiple sockets/timers the easiest way is to use copas.
Here's how to wrap localbus socket into copas context:
Quote:We are confusing what happens with queue if is too long?If the queue is too long then new message will be dropped.
Quote:Can get somehow batch of e.g. ten telegrams in one step?You can use lb:loop(timeout) to loop for a certain time. For this to work correctly you should set default timeout to a smaller value when creating localbus socket via new(timeout).
Quote:Can we filter somehow range of group addresess to listen?Localbus will receive all messages anyway so you need to filter groups manually in callback functions.
Quote:What is return value of lb.step?step return true when any message was received or nil, error on timeout.
If you want to correctly communicate with multiple sockets/timers the easiest way is to use copas.
Here's how to wrap localbus socket into copas context:
Code:
copas.addserver(lb.sock, function()
lb.sock = copas.wrap(lb.sock)
while true do
lb:step()
end
end, 1)