First pass at client:sync()

For the moment only the amount of iterations, or processing events foerever,
can be specified. The timeout is not yet configurable.
This commit is contained in:
Adrian Perez de Castro
2016-07-04 03:19:16 +03:00
parent 02b3d880a6
commit fabb5330d1

View File

@@ -420,6 +420,15 @@ function Client:_sync(options)
end end
end end
function Client:sync(niters)
while niters == nil or niters > 0 do
self:_sync { timeout = 15000 }
if niters then
niters = niters - 1
end
end
end
function Client:_sync_handle_room__join(room_id, data) function Client:_sync_handle_room__join(room_id, data)
local room = self:_make_room(room_id) local room = self:_make_room(room_id)
room:_push_events(data.timeline.events) room:_push_events(data.timeline.events)