class Meshchat::Network::Message::NodeListHash

Public Instance Methods

handle() click to toggle source

node list hash is received @return [NilClass] no output for this message type

# File lib/meshchat/network/message/node_list_hash.rb, line 12
def handle
  respond
  nil
end
message() click to toggle source
# File lib/meshchat/network/message/node_list_hash.rb, line 6
def message
  @_message ||= Node.as_sha512
end
respond() click to toggle source
# File lib/meshchat/network/message/node_list_hash.rb, line 17
def respond
  if message != Node.as_sha512
    Display.debug 'node list hashes do not match'

    node_list = _message_factory.create(
      NODE_LIST,
      data: { message: Node.as_json }
    )

    _message_dispatcher.send_message(
      uid: payload['sender']['uid'],
      message: node_list
    )
  else
    Display.debug 'node list hash matches'
  end
end