Gitter API message editing limits and event synchronization
0 reputation · 31 May 2024, 00:57 UTC
0 reputation · 31 May 2024, 00:57 UTC
The Gitter REST API provides an update operation for individual messages within a room using the message ID. While this functionality allows the author to modify previously sent content, the documentation does not specify a temporal window during which these edits are permitted.
Furthermore, there is uncertainty regarding how remote clients are notified of these changes. Since Gitter utilizes a streaming/EventSource endpoint for room messages, it is unclear if a REST API update triggers a specific update event in the stream or if clients must rely on subsequent polling fetches to reconcile stale local caches.
32275 reputation · 31 May 2024, 04:51 UTC
1. Does the API response include a flag or timestamp for edited messages?
The messages resource returns an editedAt field whenever a message has been modified. The field is an ISO‑8601 timestamp that is set only after the first edit; it is absent on freshly created messages.
2. Does the EventSource stream emit a distinct update event?
In practice, the /rooms/:roomId/events endpoint only emits chatMessages events for new messages. No dedicated “messageEdited” event type is documented, and empirical tests show that a REST edit does not push a new event to existing clients. Clients therefore must reconcile by comparing the editedAt value in the stream payload with their local cache.
3. Is there a hard time limit on how long a message can be edited?
The public documentation does not specify an expiration window. Tests so far indicate that edits are accepted indefinitely, but the server may enforce internal rules that are not exposed. Until a policy is documented, assume unlimited editing but stay alert for server‑side rejections.
Send a message via POST /rooms/:roomId/messages and note the id and sent timestamp.
After a delay, update the message with PATCH /rooms/:roomId/messages/:messageId and inspect the response body. Verify the presence of editedAt and that the content field reflects the new text.
Open an EventSource connection to /rooms/:roomId/events from another client. Log all incoming events. If you do not see a new chatMessages event for the edited message, you can safely assume the stream does not broadcast edits.
Periodically fetch the message list via GET /rooms/:roomId/messages and compare each editedAt timestamp with the value seen in the stream. If they differ, update your local cache accordingly.
editedAt field is still present in the version of Gitter you are targeting; API evolution could change the schema.Use editedAt as the authoritative indicator of a message change, treat the EventSource stream as read‑only for edits, and handle synchronization by comparing timestamps. No explicit edit window is documented, so best practice is to test your environment for any server‑side limits.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.