crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 274 forks source link

force_reregister not working as expected #2016

Open om26er opened 2 years ago

om26er commented 2 years ago
  1. Register a procedure without force_reregister
  2. Register the same procedure with force_reregister

Result:

Expected:

om26er commented 2 years ago

The text on this page clearly states that the previous client(s) should use have registered with force_reregister for the following client to actually cause a reregister. https://crossbar.io/docs/Registration-Options/#force-reregister

Here is code for client 1

import txaio
txaio.use_asyncio() # noqa

from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import SessionDetails

class Session(ApplicationSession):
    async def onJoin(self, details: SessionDetails):
        reg = await self.register(lambda: print("CALL"), "com.thing.test")
        print("registered", reg.procedure)

if __name__ == '__main__':
    runner = ApplicationRunner("ws://localhost:8080/ws", realm="realm1")
    runner.run(Session, log_level="debug")

Code for client 2

import txaio
txaio.use_asyncio() # noqa

from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import SessionDetails, RegisterOptions

class Session(ApplicationSession):
    async def onJoin(self, details: SessionDetails):
        reg = await self.register(lambda: print("CALL"), "com.thing.test", options=RegisterOptions(force_reregister=True))
        print("registered", reg.procedure)

if __name__ == '__main__':
    runner = ApplicationRunner("ws://localhost:8080/ws", realm="realm1")
    runner.run(Session, log_level="debug")
oberstet commented 2 years ago

fwiw, it's long ago I touched the code, but I agree, the behavior doesn't match what is in the docs (which does make sense). most likely not a big deal .. some lines ..