Module: EventMachine::Wssh::Connect

Extended by:
Service
Defined in:
lib/em/wssh/connect.rb

Defined Under Namespace

Modules: Http Classes: Dst

Constant Summary collapse

Title =
'HTTP Connect proxy to WSSH server'
Need =
%w(faye/websocket)

Instance Attribute Summary

Attributes included from Service

#options

Class Method Summary collapse

Methods included from Service

daemonize!, daemonize?, getopt, go!, helptions, homebase, log, loop!, mkdir, path, pid

Class Method Details

.helpObject



21
22
23
24
25
26
27
28
29
# File 'lib/em/wssh/connect.rb', line 21

def self.help
  require_relative 'exe'
  puts <<-EOF
Simple HTTP CONNECT proxy to WSSH daemon

#{Exe.usage} [options...] ws[s]://host[:port]/uri
  EOF
  helptions
end

.listen!Object



170
171
172
173
174
# File 'lib/em/wssh/connect.rb', line 170

def self.listen!
  options[:uri]=TLS.wrap options[:uri]
  conn=EM.start_server options[:host], options[:port], Http
  options[:onlisten].call Socket.unpack_sockaddr_in(EM.get_sockname conn)[0] if options[:onlisten]
end