Class: NIO::WebSocket::Adapter::Server

Inherits:
NIO::WebSocket::Adapter show all
Defined in:
lib/nio/websocket/adapter/server.rb

Instance Attribute Summary

Attributes inherited from NIO::WebSocket::Adapter

#driver

Attributes inherited from RawAdapter

#closing, #inner, #monitor, #options

Instance Method Summary collapse

Methods inherited from NIO::WebSocket::Adapter

#close, #read, #teardown

Methods inherited from RawAdapter

#add_to_reactor, #close, #pump_buffer, #read, #teardown, #write

Constructor Details

#initialize(io, options) ⇒ Server

Returns a new instance of Server.



7
8
9
10
11
12
13
14
15
16
# File 'lib/nio/websocket/adapter/server.rb', line 7

def initialize(io, options)
  driver = ::WebSocket::Driver.server(self, options[:websocket_options] || {})
  driver.on :connect do
    if ::WebSocket::Driver.websocket? driver.env
      driver.start
      WebSocket.logger.debug "driver connected"
    end
  end
  super io, driver, options
end