Hi, I'm trying to figure out how to use sipyco.sync_struct to keep objects in sync, but I'm not sure exactly how.
Here is by code for the publisher:

f = Notifier([100])
server_notify = Publisher({"freq": f})`

loop = asyncio.new_event_loop()
loop.run_until_complete(server_notify.start("::1", 2024))

And here is my code for the receiver or subscriber

class Hello():

    def sub_init(self, data):
        self.frequency = data
        print(data)
        return data
        
    def subscribe(self):
        self.subscriber = Subscriber("freq", self.sub_init)
        

def main():
    loop = asyncio.new_event_loop()

    h = Hello()
    h.subscribe()

    loop.run_until_complete(h.subscriber.connect("::1", 2024))

When I try run the publisher, I get a 'task was destroyed but is pending'. I think the loop.run_until_complete is the problem, but I'm not sure what to replace it with (run forever can't accept an argument). I was inspired by the artiq_master.py file.

I see that https://forum.m-labs.hk/d/819-subscribing-to-datasets-outside-of-the-artiq-environment has covered how to make the subscriber portion work, but I am not sure about the publisher portion.

    chemband
    The issue here is that you need to run the publisher and/or subscriber continuously. You can apply the fix from the mentioned forum post, using async def function with continuous loop, or more simply use loop.create_task() with run_forever() as shown below:

    diff --git a/publisher.py b/publisher.py
    index fb9c1d9..633549c 100644
    --- a/publisher.py
    +++ b/publisher.py
    @@ -2,4 +2,7 @@ f = Notifier([100])
     server_notify = Publisher({"freq": f})
     
     loop = asyncio.new_event_loop()
    -loop.run_until_complete(server_notify.start("::1", 2024))
    +asyncio.set_event_loop(loop)
    +
    +loop.create_task(server_notify.start("::1", 2024))
    +loop.run_forever()
    diff --git a/subscriber.py b/subscriber.py
    index 847cfa0..8ad5450 100644
    --- a/subscriber.py
    +++ b/subscriber.py
    @@ -11,8 +11,10 @@ class Hello():
     
     def main():
         loop = asyncio.new_event_loop()
    +    asyncio.set_event_loop(loop)
     
         h = Hello()
         h.subscribe()
     
    -    loop.run_until_complete(h.subscriber.connect("::1", 2024))
    +    loop.create_task(h.subscriber.connect("::1", 2024))
    +    loop.run_forever()