Sha256: 5f1000f6cd4c2681812f8e264ede5cc48966029944c5d4222ebc1cfec5ddfecb

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

module EventMachine
  module WebSocket
    class Handler
      include Debugger

      attr_reader :request, :state

      def initialize(connection, request, debug = false)
        @connection, @request = connection, request
        @debug = debug
        @state = :handshake
        initialize_framing
      end

      def run
        @connection.send_data handshake
        @state = :connected
        @connection.trigger_on_open
      end

      # Handshake response
      def handshake
        # Implemented in subclass
      end

      def receive_data(data)
        @data << data
        process_data(data)
      end

      def close_websocket(code, body)
        # Implemented in subclass
      end

      def unbind
        @state = :closed
        @connection.trigger_on_close
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
em-websocket-0.3.5 lib/em-websocket/handler.rb
em-websocket-0.3.2 lib/em-websocket/handler.rb
em-websocket-0.3.1 lib/em-websocket/handler.rb
em-websocket-0.3.0 lib/em-websocket/handler.rb