Method: JsChat::Protocol#process_message

Defined in:
lib/jschat/client.rb

#process_message(json) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/jschat/client.rb', line 129

def process_message(json)
  command = get_command json

  if command
    time = get_time json
    response = send(protocol_method_name(command, json[command]), json[json[command]])
    case response
    when Array
      response
    when String
      Response.new(response, time)
    end
  end
end