Method: Patch::IO::Websocket::Socket#start

Defined in:
lib/patch/io/websocket/socket.rb

#start(config, &block) ⇒ Boolean

Start the websocket

Parameters:

  • config (Hash)

Returns:

  • (Boolean)


44
45
46
47
48
49
50
51
52
53
54
# File 'lib/patch/io/websocket/socket.rb', line 44

def start(config, &block)
  EM::WebSocket.run(config) do |websocket|
    ::Thread.current.abort_on_exception = true
    begin
      enable(websocket)
    rescue Exception => exception
      ::Thread.main.raise(exception)
    end
  end
  true
end