Sha256: 34807f0d5e5737adecd3b9e4638625aeef9a1b3756c10a826928080f3694bd6e
Contents?: true
Size: 942 Bytes
Versions: 3
Compression:
Stored size: 942 Bytes
Contents
# frozen_string_literal: true module Wamp module Manager # User facing subscripiton record class Subscription attr_accessor :subscription_id attr_reader :message, :session def initialize(message, session, subscription_id = nil) @message = message @session = session @subscription_id = subscription_id end def subscribed? !!subscription_id end def unsubscribe(&callback) return false unless subscribed? message = Wamp::Message::Unsubscribe.new(next_request_id, subscription_id) manager = Wamp::Manager::Event::Unsubscribe.new(message, session) manager.add_event_listener(callback) end def next_request_id case message when Wamp::Message::Subscribe session.create_request_id when Wamp::Message::Unsubscribe message.request_id end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xconn-0.1.2 | lib/wamp/manager/subscription.rb |
xconn-0.1.1 | lib/wamp/manager/subscription.rb |
xconn-0.1.0 | lib/wamp/manager/subscription.rb |