Skip to content

Instantly share code, notes, and snippets.

@dbramucci
Last active April 23, 2017 20:29
Show Gist options
  • Save dbramucci/795683e5aedef8e5fc84ac1605fcdeef to your computer and use it in GitHub Desktop.
Save dbramucci/795683e5aedef8e5fc84ac1605fcdeef to your computer and use it in GitHub Desktop.
  • Protocol
  • One JSON Dictionary transmitted as a string through ws or wss
  • All Packets
    • Fields
      • "PacketType" - string
        • Describes what type of packet this is
      • "PacketID" - string
        • Uniquely identifies the string transmitted
      • "ProtocolVersion" - string
        • Identifies the current version of the protocol being used
      • "SessionID" - string
        • Identifies the current user session
        • Ignored for login packets
  • Packet Types
    • "packet success": Either -> Either
      • Fields
        • "PacketReceivedID" - string
      • Role
        • Indicates that the described packet was received
    • "packet error": Either -> Either
      • Fields
        • "PacketReceivedID" - string
        • "ServerError" - string
          • Describes what error the server had
      • Role
        • Indicates packet failed
    • "malformed packet": Either -> Either
      • Fields
        • "PacketReceivedID" - string
        • "PacketText" - string
        • "Explanation" - string
      • Role
        • Shows what the server received
        • Explains why the packet is malformed
    • "login": Client -> Server
      • Fields
        • "Username" - string
        • "Password" - string
      • Role
        • Allows user to try to login
    • "login success": Server -> Client
      • Fields
        • "NewSessionID" - string
          • Session ID to use for conversation
    • "login fail": Server -> Client
      • Fields
    • "update user list": Server -> Client
      • Fields
        • "OnlineUsers" - List[string]
        • "OfflineUsers" - List[string]
      • Sends an updated list of users to all clients when
    • "change contact list": Client -> Server
      • Fields
        • "Add" - bool (True is add, false is remove)
        • "ContactUsername" - string
    • "contact update success": Server -> Client
      • Fields
        • "PacketReceivedID" - string
    • "contact update fail": Server -> Client
      • Fields
        • "PacketReceivedID" - string
        • "UserExists" - bool
        • "UserOnContactList" - bool
    • "ask for contact list": Client -> Server
      • Fields
    • "new contact list": Server -> Client
      • Fields
        • "NewContactList" - List[string]
    • "add to conversation": Client -> Server
      • Fields
        • "ConversationSessionID" - string
          • Optional Field
            • If empty the newly generated conversation id will be in add to conversation success / fail
        • "UsernameToAdd" - string
    • "add to conversation success": Server -> Client
      • Fields
        • "ConversationSessionID" - string
        • "PacketReceivedID" - string
    • "add to conversation fail": Server -> Client
      • Fields
        • "ConversationSessionID" - string
        • "PacketReceivedID" - string
        • "UserExists" - bool
        • "UserOnContactList" - bool
        • "UserInConversation" - bool
    • "conversation member update": Server -> Client
      • Fields
        • "ConversationSessionID" - string
        • "CommonContactList" - List[string]
        • "UsersInConversation" - List[string]
    • "send message": Client -> Server
      • Fields
        • "ConversationSessionID" - string
        • "MessageText" - string
    • "new conversation message": Server -> Client
      • Fields
        • "ConversationSessionID" - string
        • "Message"
        • Dictionary
          • "Username" - string
          • "Time" - string
          • "MessageText" - string
    • "request conversation log": Client -> Server
      • Fields
        • "ConversationSessionID" - string
    • "conversation log": Server -> Client
      • Fields
        • "ConversationSessionID" - string
        • "Log"
          • list
            • Dictionary
              • "Username" - string
              • "Time" - string
              • "MessageText" - string
    • "exit conversation": Client -> Server
      • Fields
        • "ConversationSessionID" - string
    • "log out"
      • Fields
@dbramucci
Copy link
Author

The text between the quotes is exactly what is required for the protocol, copy paste it when you are implementing the message type and the fields for each method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment