Guest User

Untitled

a guest
Oct 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class ServerConnection < EM::Connection
  2. # This is where the message first enters our App
  3. def receive_data(data)
  4. # use a buffer tokenizer to convert raw JSON to hash i.e. EM::BufferedTokenizer
  5. bufferd_hash = JSON.parse(buffered_data).with_indifferent_access
  6. action = data[:class]
  7. # Lookup the corresponding Action class to process data
  8. output = ActionBase.route_to_action(action, data, self)
  9.  
  10. # Respond back with the response
  11. send_data(output.to_json)
  12. end
  13. end
Add Comment
Please, Sign In to add comment