Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 2.82 KB

real-time-chat-api.md

File metadata and controls

51 lines (37 loc) · 2.82 KB

Backend Challenge - Real-time Chat API

Introduction

The "Real-time Chat API" challenge focuses on building a scalable and efficient backend system that supports real-time messaging between users.

Objectives

  • Set up a web server capable of handling WebSocket connections.
  • Implement endpoints for managing users, conversations, and messages.
  • Enable real-time updates and notifications for instant messaging.
  • Understand WebSocket protocol and handling real-time events.

Instructions

  1. Objective: Develop a Real-time Chat API that provides functionality for instant messaging.

  2. Environment Setup: Choose your preferred programming language (e.g., JavaScript, Python, Java, Go) and set up the necessary environment for WebSocket support.

  3. Implementation Details:

    • Define endpoints:
      • POST /register: Register a new user.
      • POST /login: Authenticate a user and generate a session token.
      • GET /users: Retrieve a list of all users.
      • GET /users/{userId}: Retrieve details about a specific user.
      • POST /conversations: Start a new conversation between users.
      • GET /conversations/{conversationId}: Retrieve messages from a specific conversation.
      • POST /conversations/{conversationId}/message: Send a message to a conversation.
    • Implement WebSocket support for real-time communication:
      • Establish WebSocket connections for users to send and receive messages instantly.
      • Handle message broadcasting to update all participants in a conversation in real-time.
      • Implement presence status (e.g., online, offline) for users and notify participants about changes in user status.
    • Ensure secure WebSocket connections with proper authentication and authorization mechanisms.
  4. Testing: Test your API using WebSocket clients or tools like WebSocket extensions for browsers.

    • Verify WebSocket connections for sending and receiving messages.
    • Test API endpoints for user registration, login, conversation management, and message sending.

Possible Improvements

  • Message Encryption: Implement end-to-end encryption for message security.
  • Message Status: Add support for message status indicators (e.g., read receipts, message delivered).
  • Notification Integration: Integrate with push notification services for offline message delivery.
  • Attachment Support: Allow users to send and receive media files or attachments within messages.
  • Archiving: Implement message archiving and retrieval for historical conversations.

Conclusion

By completing this challenge, you will gain practical experience in developing a Real-time Chat API and learn essential practices for backend development related to WebSocket communication and real-time messaging. Explore additional improvements and challenges to further enhance your skills.

Happy coding!