holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.04k stars 84 forks source link

Multiplexing support #5

Closed pfrazee closed 4 years ago

pfrazee commented 5 years ago

In Beaker's implementation of PeerSocket, we need each app to operate separately from each other. They need to join/leave swarm topics separately, and use the sockets separately.

In practice, I think this means

The wire protocol that Beaker is currently constructing for PeerSockets is two layers.

  1. Messaging framing with length-prefixes
  2. Protobuf schemas for individual message types (currently PeerSocketMessage and PeerSocketSessionData)

I think we could handle multiplexing by adding channels to the protobuf schemas, in which case this doesn't need to be implemented in Hyperswarm itself.

mafintosh commented 4 years ago

we multiplex