diff --git a/src/pages/docs/messages/updates-deletes.mdx b/src/pages/docs/messages/updates-deletes.mdx index 7b8b12a456..911d6aab48 100644 --- a/src/pages/docs/messages/updates-deletes.mdx +++ b/src/pages/docs/messages/updates-deletes.mdx @@ -7,13 +7,13 @@ meta_description: "Update and delete messages published to a channel, and retrie Message updates and deletes are currently Experimental, meaning the API or behaviour may change in response to customer feedback without a major SDK release. -You can update and delete messages that have been published to a channel, for usecases such as: +You can update and delete messages that have been published to a channel, for use cases such as: * **Message editing** - allow users to edit their messages in chat-like applications * **Content moderation** - remove or edit inappropriate content after publication * **Gradual message building** - a message can be published while still unfinished, and then repeatedly edited with more complete information, so that someone querying history once the message is complete will only see the final version -Updating or deleting a message does not modify any messages that have been received by subscribing clients in-place: a given Message obect is immutable. Rather, it publishes a new message to the channel, with an action of `message.update` or `message.delete`, with the same `serial` as the original message, that subscribing clients can see and act on. +Updating or deleting a message does not modify any messages that have been received by subscribing clients in-place: a given Message object is immutable. Rather, it publishes a new message to the channel, with an action of `message.update` or `message.delete`, with the same `serial` as the original message, that subscribing clients can see and act on. It also replaces the original message in message history, so history queries will see the latest version of the message (but in the place in history of the original). @@ -49,7 +49,7 @@ const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // This assumes there is an 'updates' namespace with a channel rule enabling updates and deletes const channel = realtime.channels.get('updates:example'); -// First subscribe to a messages +// First subscribe to messages await channel.subscribe((msg) => { if (msg.data === 'original-data') { // Publish an update @@ -79,7 +79,7 @@ const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // This assumes there is an 'updates' namespace with a channel rule enabling updates and deletes const channel = realtime.channels.get('updates:example'); -// First subscribe to a messages +// First subscribe to messages await channel.subscribe((msg) => { if (msg.data === 'original-data') { // Publish an update @@ -132,7 +132,7 @@ When updating a message, you can optionally provide metadata about the update op | description | A description of why the update was made. | String | | metadata | Additional metadata about the update operation. | Object | -This metadata will end up in the message's `version` property. See [Message version structure](http://localhost:8000/docs/messages/updates-deletes#version-structure) for what this looks like. +This metadata will end up in the message's `version` property. See [Message version structure](/docs/messages/updates-deletes#version-structure) for what this looks like. ## Delete a message @@ -150,7 +150,7 @@ const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // This assumes there is an 'updates' namespace with a channel rule enabling updates and deletes const channel = realtime.channels.get('updates:example'); -// First subscribe to a messages +// First subscribe to messages await channel.subscribe((msg) => { if (msg.data === 'original-data') { // Publish a delete @@ -159,7 +159,7 @@ await channel.subscribe((msg) => { // Second way: publish a new Message using the serial const msg2 = { serial: msg.serial }; - await channel.updateMessage(msg2, { description: 'reason for second update' }); + await channel.deleteMessage(msg2, { description: 'reason for second delete' }); } }); @@ -175,7 +175,7 @@ const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // This assumes there is an 'updates' namespace with a channel rule enabling updates and deletes const channel = realtime.channels.get('updates:example'); -// First subscribe to a messages +// First subscribe to messages await channel.subscribe((msg) => { if (msg.data === 'original-data') { // Publish a delete @@ -184,7 +184,7 @@ await channel.subscribe((msg) => { // Second way: publish a new Message using the serial const msg2 = { serial: msg.serial }; - await channel.updateMessage(msg2, { description: 'reason for second update' }); + await channel.deleteMessage(msg2, { description: 'reason for second delete' }); } }); @@ -223,7 +223,7 @@ When deleting a message, you can optionally provide metadata: | description | A description of why the delete was made. | String | | metadata | Additional metadata about the delete operation. | Object | -This metadata will end up in the message's `version` property. See [Message version structure](http://localhost:8000/docs/messages/updates-deletes#version-structure) for what this looks like. +This metadata will end up in the message's `version` property. See [Message version structure](/docs/messages/updates-deletes#version-structure) for what this looks like. ## Get the latest version of a message