Method: MessageBus::Implementation#last_message

Defined in:
lib/message_bus.rb

#last_message(channel) ⇒ MessageBus::Message

Get the last message published on a channel

Parameters:

  • channel (String)

    the name of the channel in question

Returns:


527
528
529
530
531
532
533
534
# File 'lib/message_bus.rb', line 527

def last_message(channel)
  if last_id = last_id(channel)
    messages = backlog(channel, last_id - 1)
    if messages
      messages[0]
    end
  end
end