Java EE Mobile Server

The mobile server consists of a chat WebSocket API and a to do list REST API implemented using the Java API for WebSocket, JSON-P, JAX-RS 2 and Java EE 7.

The WebSocket chat endpoint is at: ws://localhost:8080/javaee-mobile-server/chat. The endpoint communicates via JSON. Once connected, a client can send a chat message using this format:

        {"user": "the name of the user", 
         "message": "the chat message"}
        
Each chat message sent to the server will be echoed back to all currently connected clients including the client that sent the message. The server will also include the timestamp on the server when the message was received. The chat messages echoed back from the server will follow this format:
        {"user": "the name of the user that sent the message", 
         "message": "the echoed chat message", 
         "timestamp": "the server timestamp - MM/dd/yyyy h:mm:ss a z"}        
        

The REST endpoint is available at http://localhost:8080/javaee-mobile-server/resources/todo. The REST endpoint also communicates with the client using JSON. To do items are stored under various usernames. To retrieve the current to do items for a given user, the client must issue a GET request to this URL: http://localhost:8080/javaee-mobile-server/resources/todo/{username}. The server will respond with the list of current to do items for the user following this format:

        [{"id": "to do item ID", 
         "description": "item 1 description", 
         "completed": "true|false"},
         {"id": "to do item ID", 
         "description": "item 2 description", 
         "completed": "true|false"}
         ...]        
        
To add an item for a user, the client must issue a POST request to this URL: http://localhost:8080/javaee-mobile-server/resources/todo/{username}. The POST body must follow this format:
        {"description": "item description"}
        
An ID will be automatically assigned and the item will be assumed to be incomplete. To modify a to do item, the client must issue a PUT request to this URL: http://localhost:8080/javaee-mobile-server/resources/todo/{username}/{id}. The PUT request body must follow this format:
        {"id": "to do item ID", 
         "description": "item description", 
         "completed": "true|false"}
        
To delete a to do item, the client must issue a DELETE request to this URL: http://localhost:8080/javaee-mobile-server/resources/todo/{username}/{id}.