[WAMP] Subscribing with get_retained=True calls previous subscriber

#1

Hi,

It appears that subscribing to a topic with options=SubscribeOptions(get_retained=get_retained) 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=get_retained))
await session.subscribe(f2, 'foo', options=SubscribeOptions(get_retained=get_retained))
await session.subscribe(f3, 'foo', options=SubscribeOptions(get_retained=get_retained))

What will get printed is:

f1(bar)
f1(bar)
f2(bar)
f1(bar)
f2(bar)
f3(bar)

Is this the expected behaviour, or a bug? If it’s the expected behaviour, can I avoid it somehow?