Class: WsServer

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/template/wsserver.rb

Instance Method Summary collapse

Constructor Details

#initializeWsServer

Returns a new instance of WsServer.



19
20
21
22
23
24
25
# File 'lib/template/wsserver.rb', line 19

def initialize
  super
  @ws_list = []
  @ws_lock = Mutex.new
  @json_config = nil
  @exec_thread = nil
end

Instance Method Details

#ws_send(str) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/template/wsserver.rb', line 27

def ws_send(str)
  @ws_lock.synchronize do
    if @ws_list[0] != nil
      @ws_list[0].send(str)
    end
  end
end