Class: WsServer
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- WsServer
- Defined in:
- lib/template/wsserver.rb
Instance Method Summary collapse
-
#initialize ⇒ WsServer
constructor
A new instance of WsServer.
- #ws_send(str) ⇒ Object
Constructor Details
#initialize ⇒ WsServer
Returns a new instance of WsServer.
17 18 19 20 21 |
# File 'lib/template/wsserver.rb', line 17 def initialize super @ws_list = [] @ws_lock = Mutex.new end |
Instance Method Details
#ws_send(str) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/template/wsserver.rb', line 23 def ws_send(str) @ws_lock.synchronize do if @ws_list[0] != nil @ws_list[0].send(str) end end end |