Skip to content

Commit

Permalink
Merge pull request #545 from cameron-michie/patch-1
Browse files Browse the repository at this point in the history
Update README.md to add in 'publish message to channel including metadata'
  • Loading branch information
owenpearson committed Nov 29, 2023
2 parents b92c770 + 7073440 commit 10cb4a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ logger.addHandler(logging.StreamHandler())
await channel.publish('event', 'message')
```

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

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

### Querying the History

```python
Expand Down

0 comments on commit 10cb4a0

Please sign in to comment.