1

Good morning! I am looking at the PSS API checking the erebos/pss.js example. I am slightly confused with the follow:

const alice = new PssAPI(createRPC('ws://127.0.0.1:8501'))
const bob = new PssAPI(createRPC('ws://127.0.0.1:8502'))

Do we have to create a new connection/port for each user? Having as reference a simple chat with n users. How would this even work?

Thank you!

0

The default use case of pss is one sender/recipient per node. So in your case Alice would have a running node, Bob would have a different running node, and they each make websocket connections to their respective nodes.

You can create multiple subscriptions* on the same node (with the same topic), but both subscribers will then get the same messages. That means that distiguishing what is for who will have to be controlled in your application logic.

That being said, one running node will only have one single keypair for public key crypto, which is the same key as the swarm node is running on.


*I am unsure exactly how erebos maps to the actual calls in pss rpc calls. Via the RPC subscribe is only one action, but here it seems to be one for registering the topic and one for actually receiving messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.