You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a real-time update system to notify all users in a chat room when someone starts or stops typing. The feature will be implemented using a POST API endpoint and WebSocket notifications.
Requirements:
API Endpoint: Create a new POST API endpoint /room/:roomID/event for the typing event. This endpoint will accept an eventType to indicate whether typing has started or stopped.
Sample API Contract:
POST /room/:roomID/event { "eventType": "typing.started" }
Event Types: Two event types should be supported:
EventTypeTypingStart ("typing.started"): User has started typing.
EventTypeTypingStop ("typing.stopped"): User has stopped typing.
WebSocket Notification: Once the server receives the API request, it should broadcast this event to all users in the room using WebSockets.
Rate Limiting: Implement rate limiting for this feature to avoid unnecessary network calls. For example, limit the number of "typing started" and "typing stopped" events per user per second.
Success Criteria:
Users in the same room should see real-time updates when someone starts or stops typing.
The feature should be resilient and optimized, adhering to best practices.
The text was updated successfully, but these errors were encountered:
Implement a real-time update system to notify all users in a chat room when someone starts or stops typing. The feature will be implemented using a POST API endpoint and WebSocket notifications.
Requirements:
Sample API Contract:
POST /room/:roomID/event { "eventType": "typing.started" }
EventTypeTypingStart ("typing.started"): User has started typing.
EventTypeTypingStop ("typing.stopped"): User has stopped typing.
Success Criteria:
The text was updated successfully, but these errors were encountered: