diff options
author | Matias Linares <matiaslina@gmail.com> | 2018-10-14 18:29:06 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@gmail.com> | 2018-10-14 18:29:06 -0300 |
commit | 3d6d5a4828e602837886358918e324f34e37b962 (patch) | |
tree | adde3b6f88828da5f1ecdb0e98596868a54e4e86 /docs/client.pod6 | |
parent | 47aaf852798acb30f32f3e3ae7ca0fe28e9ac18e (diff) | |
parent | 66c31dda1500b54fd284b82478019e9da6a7e9d1 (diff) | |
download | perl6-matrix-client-3d6d5a4828e602837886358918e324f34e37b962.tar.gz |
Merge branch 'master' of ssh://deprecated.org:22333/var/www/cgit/perl6-matrix-client
Diffstat (limited to 'docs/client.pod6')
-rw-r--r-- | docs/client.pod6 | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/client.pod6 b/docs/client.pod6 index 6256cde..302e99b 100644 --- a/docs/client.pod6 +++ b/docs/client.pod6 @@ -242,4 +242,34 @@ the servers may choose to implement additional access control for this endpoint. Uploads a file to the server. It returns the MXC URI to the uploaded content. +=head2 run + + method run(Int :$sleep = 10, :$sync-filter? --> Supply) + +Returns a C<Supply> that emits L<Matrix::Response::StateEvent> with the last +events. The C<$sleep> parameter is to sleep for that amount of seconds before +making a L<sync> request again. The C<$sync-filter> is the same parameter that +will be passed to L<sync> method to filter out the useful events. + +This can be useful to turn something like: + + my $since; + loop { + $response = $client.sync(:$since); + $since = $response.next-batch; + + for $response.joined-rooms -> $room { + for $room.timeline.event -> $event { + # Do something useful with $event + } + } + } + +into: + + my $sup = $client.run(); + react whenever $sup -> $event { + # Do something useful with $event + } + =end pod |