Module: DRb::WebSocket

Defined in:
lib/drb/websocket.rb,
lib/drb/websocket/client.rb,
lib/drb/websocket/server.rb,
lib/drb/websocket/rack_app.rb,
lib/drb/websocket/ws_client.rb,
lib/drb/websocket/callback_server.rb

Defined Under Namespace

Classes: CallbackHandler, CallbackServer, ClientSide, Handler, Messages, RackApp, Server, ServerSide, StrStream, WSClient

Class Method Summary collapse

Class Method Details

.open(uri, config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/drb/websocket/client.rb', line 7

def self.open(uri, config)
  unless uri =~ /^ws:\/\/(.*?):(\d+)(\/(.*))?$/
    raise(DRbBadScheme, uri) unless uri =~ /^ws:/
    raise(DRbBadURI, 'can\'t parse uri: ' + uri)
  end

  path, uuid = $4.split('/') if $4

  unless path.nil? || path == 'callback'
    raise(DRbBadURI, 'can\'t parse uri: ' + uri)
  end

  handler = RackApp.handler(uri) || Handler.new(uri, config)
  ClientSide.new(uri, config, handler)
end

.open_server(uri, config) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/drb/websocket/server.rb', line 9

def self.open_server(uri, config)
  unless uri =~ /^ws:\/\/(.*?):(\d+)(\/(.*))?$/
    raise(DRbBadScheme, uri) unless uri =~ /^ws:/
    raise(DRbBadURI, 'can\'t parse uri: ' + uri)
  end

  if $4 == 'callback'
    CallbackServer.new(uri, config)
  else
    Server.new(uri, config)
  end
end

.uri_option(uri, config) ⇒ Object



26
27
28
# File 'lib/drb/websocket.rb', line 26

def self.uri_option(uri, config)
  return uri, nil
end