Class: Textbringer::GhostText::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/textbringer/ghost_text/server.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/textbringer/ghost_text/server.rb', line 13

def call(env)
  if Faye::WebSocket.websocket?(env)
    accept_client(env)
  else
    json = {
      "WebSocketPort" => CONFIG[:ghost_text_port],
      "ProtocolVersion" => 1
    }.to_json
    [200, {'Content-Type' => 'application/json'}, [json]]
  end
end