lib/conveyor/websocket.rb in gina-conveyor-0.2.4 vs lib/conveyor/websocket.rb in gina-conveyor-1.0.0
- old
+ new
@@ -1,16 +1,13 @@
module Conveyor
class Websocket
class << self
def start
- if config[:disable]
- fm.info "Websocket disabled"
- return
- end
+ return if config[:disabled]
fm.info "Starting websocket on #{config[:host]}:#{config[:port]}", :color => :green
-
+
EventMachine::start_server(config[:host], config[:port],
EventMachine::WebSocket::Connection, config) do |ws|
ws.onopen {
sid = fm.channel.subscribe { |type,msg| ws.send msg }
fm.info "#{sid} connected to websocket!"
@@ -32,6 +29,6 @@
def config
fm.config[:websocket]
end
end
end
-end
\ No newline at end of file
+end