Fix jsonification of messages and refactoring

Summary:
- direct_messages "connection" property was renamed to "websocket" (what represents precisely what the property maps)
- fixed jsonification of messages (Code.TYPE wasn't being properly converted when it was in a different position of values than 0]