Reference architecture or example for p2p node?

Hi, I am planning to write a peer-to-peer node in python utilizing Autobahn web sockets. As a p2p node I would like to receive incoming connections from other nodes as well as initiate connections to other nodes. It should also be able to send broadcast messages to all peer nodes.

I checked the architecture of Autobahn and it seems to me that the it is strongly based on the client-server model. In a sense my node should behave as a server as well as a client, relying on the same “engine” i.e. the component that holds the business logic of my node. My question is in which architecture could I use the components of Autobahn to create such a node? Maybe I should keep a reference to my engine in the instances of both my WebSocketClientFactory and WebSocketServerFactory implementation so the client and the server workers (protocols) could access it? Also, how can I implement the broadcast message? I found the broadcast example of Autobahn and I understand that server should administer the remote clients so it can send the broadcast message one-to-one to each client. But supposing that I created a client protocol instance for each ongoing connections, I should administer both these “local” clients a part of the “remote” clients? Aren’t a unified way to do this?

Thank you for your help,