Sha256: 1ee1f5c5dfa28df9214889dfd579d8532a82b5ab161d9edcd93cd490a730a3af
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module Audiences def aud_to_str(aud) "#{aud.service_name}.#{aud.component_name}.#{aud.operation_type}.#{aud.operation_name}" end def str_to_aud(str) # TODO: move to common package parts = str.split('.') aud = Streamdal::Protos::Audience.new aud.service_name = parts[0] aud.component_name = parts[1] aud.operation_type = parts[2] aud.operation_name = parts[3] aud end def _seen_audience(aud) @audiences.key?(aud_to_str(aud)) end def _add_audience(aud) # Add an audience to the local cache map and send to server return if _seen_audience(aud) @audiences[aud_to_str(aud)] = aud req = Streamdal::Protos::NewAudienceRequest.new req.session_id = @session_id req.audience = aud @stub.new_audience(req, metadata: _metadata) end def _add_audiences # This method is used to re-announce audiences after a disconnect @audiences.each do |aud| req = Streamdal::Protos::NewAudienceRequest.new req.session_id = @session_id req.audience = aud @stub.new_audience(req, metadata: _metadata) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
streamdal-0.0.5 | lib/audiences.rb |
streamdal-0.0.4 | lib/audiences.rb |
streamdal-0.0.3 | lib/audiences.rb |
streamdal-0.0.2 | lib/audiences.rb |