module Meshchat

Constants

VERSION

Public Instance Methods

bootstrap_runloop(app_config) click to toggle source
# File lib/meshchat.rb, line 59
def bootstrap_runloop(app_config)
  # 1. hook up the display / output 'device'
  #    - responsible for notifications
  #    - created in Configuration
  display = Display

  # 2. create the message dispatcher
  #    - boots the local and relay network connections
  #    - sends the messages out to the network
  #    - tries p2p first, than uses the relays
  message_dispatcher = Network::Dispatcher.new

  # 3. hook up the keyboard / input 'device'
  #    - tesponsible for parsing input
  input_receiver = Ui::CLI.new(
    message_dispatcher,
    message_dispatcher._message_factory,
    display
  )

  # by default the app_config[:input] is
  # Meshchat::Cli::KeyboardLineInput
  # EM.open_keyboard(app_config[:input], input_receiver)
  input = app_config[:input].new(input_receiver)
  input.try(:start)
end
start(overrides = {}) click to toggle source

@param [Hash] overrides @option overrides [Proc] on_display_start what to do upon start of the display manager @option overrides [class] display the display ui to use inherited from Display::Base

# File lib/meshchat.rb, line 48
def start(overrides = {})
  app_config = Configuration::AppConfig.new(overrides)
  app_config.validate

  # if everything is configured correctly, boot the app
  # this handles all of the asyncronous stuff
  EventMachine.run do
    bootstrap_runloop(app_config)
  end
end