Class: Ably::Models::ChannelMetrics

Inherits:
Object
  • Object
show all
Extended by:
Ably::Modules::Enum, Forwardable
Includes:
Ably::Modules::ModelCommon
Defined in:
lib/ably/models/channel_metrics.rb

Overview

Contains the metrics associated with a Rest::Channel or Realtime::Channel, such as the number of publishers, subscribers and connections it has.

Instance Attribute Summary collapse

Attributes included from Ably::Modules::ModelCommon

#hash

Instance Method Summary collapse

Methods included from Ably::Modules::ModelCommon

#==, #[], #as_json, included, #to_json, #to_s

Methods included from Ably::Modules::MessagePack

#to_msgpack

Constructor Details

#initialize(attrs) ⇒ ChannelMetrics

Initialize a new ChannelMetrics



35
36
37
# File 'lib/ably/models/channel_metrics.rb', line 35

def initialize(attrs)
  @attributes = IdiomaticRubyWrapper(attrs.clone)
end

Instance Attribute Details

#attributesObject (readonly) Also known as: to_h

The attributes of ChannelMetrics (CHM2)



29
30
31
# File 'lib/ably/models/channel_metrics.rb', line 29

def attributes
  @attributes
end

Instance Method Details

#connectionsInteger

The number of realtime connections attached to the channel.

Returns:

  • (Integer)


45
46
47
# File 'lib/ably/models/channel_metrics.rb', line 45

def connections
  attributes[:connections]
end

#presence_connectionsInteger

The number of realtime connections attached to the channel with permission to enter the presence set, regardless of whether or not they have entered it. This requires the presence capability and for a client to not have specified a Ably::Models::ChannelOptions::MODES flag that excludes Ably::Models::ChannelOptions::MODES#PRESENCE.

Returns:

  • (Integer)


57
58
59
# File 'lib/ably/models/channel_metrics.rb', line 57

def presence_connections
  attributes[:presence_connections]
end

#presence_membersInteger

The number of members in the presence set of the channel.

Returns:

  • (Integer)


67
68
69
# File 'lib/ably/models/channel_metrics.rb', line 67

def presence_members
  attributes[:presence_members]
end

#presence_subscribersInteger

The number of realtime attachments receiving presence messages on the channel. This requires the subscribe capability and for a client to not have specified a Ably::Models::ChannelOptions::MODES flag that excludes Ably::Models::ChannelOptions::MODES#PRESENCE_SUBSCRIBE.

Returns:

  • (Integer)


79
80
81
# File 'lib/ably/models/channel_metrics.rb', line 79

def presence_subscribers
  attributes[:presence_subscribers]
end

#publishersInteger

The number of realtime attachments permitted to publish messages to the channel. This requires the publish capability and for a client to not have specified a Ably::Models::ChannelOptions::MODES flag that excludes Ably::Models::ChannelOptions::MODES#PUBLISH.

Returns:

  • (Integer)


91
92
93
# File 'lib/ably/models/channel_metrics.rb', line 91

def publishers
  attributes[:publishers]
end

#subscribersInteger

The number of realtime attachments receiving messages on the channel. This requires the subscribe capability and for a client to not have specified a Ably::Models::ChannelOptions::MODES flag that excludes Ably::Models::ChannelOptions::MODES#SUBSCRIBE.

Returns:

  • (Integer)


103
104
105
# File 'lib/ably/models/channel_metrics.rb', line 103

def subscribers
  attributes[:subscribers]
end