r/Redd•
mwpastore

Stream messages?

Answered

Is it possible to stream comment replies? e.g.:

session.my_messages(:category=>'comments').stream { |comment| .. }

Thanks in advance.

EDIT: It looks like PRAW supports it (see here). I wonder if it would be possible to duplicate this functionality in Redd.

Posted Oct 16, 2017, 4:47 PM UTC · edited

33
mwpastoreOP•

This seems to be working. Let me know if I'm on the right track!

options = { :category=>'unread' }.freeze
Redd::Models::PaginatedListing.new(SESSION.client, options) do |**req_options|
  SESSION.my_messages(options.merge(req_options))
end.stream do |comment|
  next unless comment.instance_of?(Redd::Models::Comment)

  # ..
end
2
MustermindRedd Developer•

That does seem to be on the right track. I'm tracking that issue here and I'll get to it as soon as possible.

Thanks!

1
mwpastoreOP•

Great! Thank you!

1