autobahn-python
autobahn-python copied to clipboard
Subscribing with get_retained=True calls previous subscriber
Hi,
It appears that subscribing to a topic with options=SubscribeOptions(get_retained=True) causes previous subscribers to get called again. For example, suppose that someone has already posted 'bar' to a topic 'foo', and we run this:
def f1(msg):
print(f"f1({msg})")
def f2(msg):
print(f"f2({msg})")
def f3(msg):
print(f"f3({msg})")
await session.subscribe(f1, 'foo', options=SubscribeOptions(get_retained=True))
await session.subscribe(f2, 'foo', options=SubscribeOptions(get_retained=True))
await session.subscribe(f3, 'foo', options=SubscribeOptions(get_retained=True))
What will get printed is:
f1(bar)
f1(bar)
f2(bar)
f1(bar)
f2(bar)
f3(bar)