Method: JsChat::Bridge#send_json
- Defined in:
- lib/jschat/http/jschat.rb
#send_json(h, get_results = true) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/jschat/http/jschat.rb', line 158 def send_json(h, get_results = true) response = nil h[:cookie] = @cookie if c = TCPSocket.open(ServerConfig['ip'], ServerConfig['port']) c.send(h.to_json + "\n", 0) if get_results response = c.gets response = JSON.parse(response) end ensure c.close response end |