Class: Skyfall::Firehose::InfoMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/skyfall/firehose/info_message.rb

Overview

An informational firehose message from the websocket service itself, unrelated to any repos.

Currently there is only one type of message defined, ‘“OutdatedCursor”`, which is sent when the client connects with a cursor that is older than the oldest event currently kept in the backfill buffer. This message means that you’re likely missing some events that were sent since the last time the client was connected but which were already deleted from the buffer.

Note: the Message#did, Message#seq and Message#time properties are always nil for #info messages.

Constant Summary collapse

OUTDATED_CURSOR =

Message which means that the cursor passed when connecting is older than the oldest event currently kept in the backfill buffer, and that you’ve likely missed some events that have already been deleted

"OutdatedCursor"

Instance Attribute Summary collapse

Attributes inherited from Message

#data_object, #did, #seq, #type, #type_object

Instance Method Summary collapse

Methods inherited from Message

#inspect, new, #operations, #time, #unknown?

Constructor Details

#initialize(type_object, data_object) ⇒ InfoMessage

Returns a new instance of InfoMessage.

Parameters:

  • type_object (Hash)

    first decoded CBOR frame with metadata

  • data_object (Hash)

    second decoded CBOR frame with payload

Raises:

  • (DecodeError)

    if the message doesn’t include required data



38
39
40
41
42
43
44
# File 'lib/skyfall/firehose/info_message.rb', line 38

def initialize(type_object, data_object)
  super
  check_if_not_nil 'name'

  @name = @data_object['name']
  @message = @data_object['message']
end

Instance Attribute Details

#messageString? (readonly)

Returns a human-readable description.

Returns:

  • (String, nil)

    a human-readable description



25
26
27
# File 'lib/skyfall/firehose/info_message.rb', line 25

def message
  @message
end

#nameString (readonly)

Returns short machine-readable code of the info message.

Returns:

  • (String)

    short machine-readable code of the info message



22
23
24
# File 'lib/skyfall/firehose/info_message.rb', line 22

def name
  @name
end

Instance Method Details

#to_sString

Returns a formatted summary.

Returns:

  • (String)

    a formatted summary



47
48
49
# File 'lib/skyfall/firehose/info_message.rb', line 47

def to_s
  (@name || "InfoMessage") + (@message ? ": #{@message}" : "")
end