diff --git a/examples/ble_chat.py b/examples/ble_chat.py index 2bce138..2779d2b 100755 --- a/examples/ble_chat.py +++ b/examples/ble_chat.py @@ -29,6 +29,7 @@ async def main () : args = parser.parse_args() mc = await MeshCore.create_ble(args.addr) + await mc.ensure_contacts() # Subscribe to private messages private_subscription = mc.subscribe(EventType.CONTACT_MSG_RECV, handle_message) @@ -38,8 +39,6 @@ async def main () : await mc.start_auto_message_fetching() - await mc.ensure_contacts() - contact = mc.get_contact_by_name(args.dest) if contact is None: print(f"Contact '{DEST}' not found in contacts.") diff --git a/examples/tcp_chat.py b/examples/tcp_chat.py index 7323aa7..ef273e0 100755 --- a/examples/tcp_chat.py +++ b/examples/tcp_chat.py @@ -32,6 +32,8 @@ async def main () : mc = await MeshCore.create_tcp(args.addr, args.port) + await mc.ensure_contacts() + # Subscribe to private messages private_subscription = mc.subscribe(EventType.CONTACT_MSG_RECV, handle_message) @@ -40,8 +42,6 @@ async def main () : await mc.start_auto_message_fetching() - await mc.ensure_contacts() - contact = mc.get_contact_by_name(args.dest) if contact is None: print(f"Contact '{DEST}' not found in contacts.")