await self._open()
coroot_guid = await self._call('attributsknoten',
['coroot_name', self.conf['name']])
- comessage_guid = await self._call('erzeuge', ['comessage'])
- if coroot_guid and comessage_guid:
- await self._call('verknuepfe', [comessage_guid, coroot_guid])
- messages = self._messages
- self._messages = []
- await self._call('setze', [comessage_guid, 'comessage_json',
- json.dumps(messages)])
- await self._call('setze', [comessage_guid, 'comessage_ready',
- True])
+ if coroot_guid:
+ comessage_guid = await self._call('erzeuge', ['comessage'])
+ if comessage_guid:
+ await self._call('verknuepfe', [comessage_guid,
+ coroot_guid])
+ messages = self._messages
+ self._messages = []
+ await self._call('setze', [comessage_guid,
+ 'comessage_json',
+ json.dumps(messages)])
+ await self._call('setze', [comessage_guid,
+ 'comessage_ready',
+ True])
await self._close()
async def _receive(self, message: Message) -> None:
await self._open()
coroot_guid = await self._call('attributsknoten',
['coroot_name', self.conf['name']])
- comessage_guid = await self._call('erzeuge', ['comessage'])
- if coroot_guid and comessage_guid:
- await self._call('verknuepfe', [comessage_guid, coroot_guid])
- messages = [Message(self.name, {'event': 'connection opened'})]
- await self._call('setze', [comessage_guid, 'comessage_json',
- json.dumps(messages)])
- await self._call('setze', [comessage_guid, 'comessage_ready',
- True])
+ if coroot_guid:
+ comessage_guid = await self._call('erzeuge', ['comessage'])
+ if comessage_guid:
+ await self._call('verknuepfe', [comessage_guid,
+ coroot_guid])
+ messages = [Message(self.name, {'event': 'connection opened'})]
+ await self._call('setze', [comessage_guid,
+ 'comessage_json',
+ json.dumps(messages)])
+ await self._call('setze', [comessage_guid,
+ 'comessage_ready',
+ True])
await self._close()