import asyncio from autobahn. asyncio . wamp import ApplicationSession , ApplicationRunner class Component ( ApplicationSession ) : async def onJoin ( self , details ) : def on_event ( i ) : print ( "Got: {}" . format ( i ) ) # pareil on chope la souscription sub = await self . subscribe ( on_event , u 'mon.uri.pour.un.event' ) # et on demande la liste des 10 derniers events pour cet abo events = await self . call ( 'wamp.subscription.get_events' , sub. id , 10 ) # et on boucle. Et on kiff await parceque putain c’est pratique. for event in events: print ( event [ 'timestamp' ] , event [ 'publication' ] , event [ 'args' ] [ 0 ] ) def onDisconnect ( self ) : asyncio. get_event_loop ( ) . stop ( ) if __name__ == '__main__' : runner = ApplicationRunner ( "ws://127.0.0.1:8080/ws" , 'realm1' ) runner. run ( Component )