A convenience method to send objects as message content. Send specified object over this sender; the object is expected to have a ``send()`` method on it that takes the sender and an optional tag as arguments. Where the object is a :class:`Message`, this wi
(self, obj: Union[bytes, 'Message'], tag: Optional[str] = None)
| 1163 | return self._check(pn_link_send(self._impl, data)) |
| 1164 | |
| 1165 | def send(self, obj: Union[bytes, 'Message'], tag: Optional[str] = None) -> Union[int, Delivery]: |
| 1166 | """ |
| 1167 | A convenience method to send objects as message content. |
| 1168 | |
| 1169 | Send specified object over this sender; the object is expected to |
| 1170 | have a ``send()`` method on it that takes the sender and an optional |
| 1171 | tag as arguments. |
| 1172 | |
| 1173 | Where the object is a :class:`Message`, this will send the message over |
| 1174 | this link, creating a new delivery for the purpose. |
| 1175 | """ |
| 1176 | if hasattr(obj, 'send'): |
| 1177 | return obj.send(self, tag=tag) |
| 1178 | else: |
| 1179 | # treat object as bytes |
| 1180 | return self.stream(obj) |
| 1181 | |
| 1182 | def delivery_tag(self) -> str: |
| 1183 | """Increments and returns a counter to be used as the next message tag.""" |