Module: Socket2me

Defined in:
lib/socket2me/ws_server.rb,
lib/socket2me.rb,
lib/socket2me/version.rb,
lib/socket2me/configuration.rb,
lib/socket2me/middleware/add_script_tag.rb

Overview

Singleton wrapper class around an EM::WebSocket thread.

Defined Under Namespace

Modules: Middleware Classes: Configuration, WsServer

Constant Summary collapse

VERSION =
'0.6.0'.freeze

Class Method Summary collapse

Class Method Details

.configConfiguration

Returns current configuration.

Returns:



32
33
34
# File 'lib/socket2me/configuration.rb', line 32

def self.config
  @config
end

.configure {|Configuration| ... } ⇒ Object

Yields:



26
27
28
29
# File 'lib/socket2me/configuration.rb', line 26

def self.configure(&block)
  @config ||= Configuration.new
  block.call @config if block_given?
end

.exec_js(js) ⇒ Object



11
12
13
# File 'lib/socket2me.rb', line 11

def self.exec_js(js)
  WsServer.instance.send_to_clients(js)
end

.start_ws_serverObject



7
8
9
# File 'lib/socket2me.rb', line 7

def self.start_ws_server
  WsServer.instance.start
end