Skip to content

Commit

Permalink
Update README.md with changes to 'publish message with metadata'
Browse files Browse the repository at this point in the history
Added changed suggested to align with PEP8 and make it a bit clearer
  • Loading branch information
cameron-michie committed Nov 29, 2023
1 parent ec20e30 commit 7073440
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ logger.addHandler(logging.StreamHandler())
await channel.publish('event', 'message')
```

### Publishing a message to a channel including metadata

If you need to add metadata when publishing a message, you can use the `Message` constructor to create a message with custom fields:
```python
from ably.types.message import Message
messageObject = Message(name="messagename",
data="payload",
extras={"headers": {"metadataKey": "metadataValue"}})
await channel.publish(messageObject)

message_object = Message(name="message_name",
data="payload",
extras={"headers": {"metadata_key": "metadata_value"}})
await channel.publish(message_object)
```

### Querying the History
Expand Down

0 comments on commit 7073440

Please sign in to comment.