Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ServerConnection < EM::Connection
- # This is where the message first enters our App
- def receive_data(data)
- # use a buffer tokenizer to convert raw JSON to hash i.e. EM::BufferedTokenizer
- bufferd_hash = JSON.parse(buffered_data).with_indifferent_access
- action = data[:class]
- # Lookup the corresponding Action class to process data
- output = ActionBase.route_to_action(action, data, self)
- # Respond back with the response
- send_data(output.to_json)
- end
- end
Add Comment
Please, Sign In to add comment