Module: Zulip::Client::EventStreaming

Included in:
Zulip::Client
Defined in:
lib/zulip/client/event_streaming.rb

Instance Method Summary collapse

Instance Method Details

#stream_events(event_types, &block) ⇒ Object



21
22
23
24
25
# File 'lib/zulip/client/event_streaming.rb', line 21

def stream_events(event_types, &block)
  stream_raw_events(event_types) do |raw_event|
    yield parse_event(raw_event)
  end
end

#stream_messages(&block) ⇒ Object



5
6
7
# File 'lib/zulip/client/event_streaming.rb', line 5

def stream_messages(&block)
  stream_events("message", &block)
end

#stream_private_messages(&block) ⇒ Object



9
10
11
12
13
# File 'lib/zulip/client/event_streaming.rb', line 9

def stream_private_messages(&block)
  stream_raw_events("message") do |raw_event|
    yield parse_event(raw_event) if private_message?(raw_event)
  end
end

#stream_public_messages(&block) ⇒ Object



15
16
17
18
19
# File 'lib/zulip/client/event_streaming.rb', line 15

def stream_public_messages(&block)
  stream_raw_events("message") do |raw_event|
    yield parse_event(raw_event) if public_message?(raw_event)
  end
end