lib/web-repl/repl.rb
# Start the Websocket connection (blocking)
# @param [Hash] options
# @option options [Boolean] :background Do not wait for input, just run in the bg
Start the Websocket connection (blocking)
Start the Websocket connection ( blocking )
def start(options = {}, &block)
      @thread = Thread.new do
        EM::WebSocket.run(@config) do |ws|
          if @socket.nil?
            @socket = ws
            @messenger = Messenger.new(@socket)
            configure_event_handling(:background => options[:background], &block)
          end
        end
      end
      Thread.abort_on_exception = true
      acknowledge_handshake do
        yield if block_given?
        input(options) unless !!options[:background]
      end
    end
def start ( options = { } , & block ) @thread = Thread . new do EM :: WebSocket . run ( @config ) do | ws | if @socket . nil? @socket = ws @messenger = Messenger . new ( @socket ) configure_event_handling ( :background => options [ :background ] , & block ) end end end Thread . abort_on_exception = true acknowledge_handshake do yield if block_given? input ( options ) unless ! ! options [ :background ] end end
Start the Websocket connection (blocking)
Start the Websocket connection ( blocking )
#@thread.join unless !!options[:background]
options
:background Do not wait for input, just run in the bg
: background Do not wait for input just run in the bg
block
None