class Meshchat::Network::Incoming::RequestProcessor

all this does is pull the encrypted message out of the received request

Attributes

_message_processor[R]

Public Class Methods

new(network: NETWORK_LOCAL, message_dispatcher: nil, location: nil) click to toggle source
# File lib/meshchat/network/incoming/request_processor.rb, line 10
def initialize(network: NETWORK_LOCAL, message_dispatcher: nil, location: nil)
  @_message_processor = MessageProcessor.new(
    network: network,
    message_dispatcher: message_dispatcher,
    location: location
  )
end

Public Instance Methods

parse_content(content) click to toggle source
# File lib/meshchat/network/incoming/request_processor.rb, line 24
def parse_content(content)
  content = JSON.parse(content) if content.is_a?(String)
  content['message']
end
process(request_body) click to toggle source

@param [String] request_body - the encrypted message as a json string

# File lib/meshchat/network/incoming/request_processor.rb, line 19
def process(request_body)
  encoded_message = parse_content(request_body)
  _message_processor.process(encoded_message)
end