@@ -21,7 +21,7 @@ import (
21
21
)
22
22
23
23
var (
24
- // Each NegotiationConnection () function call spawns a new stream.
24
+ // Each NegotiateConnection () function call spawns a new stream.
25
25
streamIDLength = len (uuid .NewString ())
26
26
// We shouldn't PubSub anything larger than this!
27
27
maxPayloadSizeBytes = 8192
@@ -36,8 +36,19 @@ type ProxyOptions struct {
36
36
37
37
// ProxyDial writes client negotiation streams over PubSub.
38
38
//
39
- // PubSub is used to geodistribute in a simple way. All message payloads
40
- // are small in size <=8KB, and we don't require delivery guarantees.
39
+ // PubSub is used to geodistribute WebRTC handshakes. All negotiation
40
+ // messages are small in size (<=8KB), and we don't require delivery
41
+ // guarantees because connections can always be renegotiated.
42
+ // ┌────────────────────┐ ┌─────────────────────────────┐
43
+ // │ coderd │ │ coderd │
44
+ // ┌─────────────────────┐ │/<agent-id>/connect │ │ /<agent-id>/listen │
45
+ // │ client │ │ │ │ │ ┌─────┐
46
+ // │ ├──►│Creates a stream ID │◄─►│Subscribe() to the <agent-id>│◄──┤agent│
47
+ // │NegotiateConnection()│ │and Publish() to the│ │channel. Parse the stream ID │ └─────┘
48
+ // └─────────────────────┘ │<agent-id> channel: │ │from payloads to create new │
49
+ // │ │ │NegotiateConnection() streams│
50
+ // │<stream-id><payload>│ │or write to existing ones. │
51
+ // └────────────────────┘ └─────────────────────────────┘
41
52
func ProxyDial (client proto.DRPCPeerBrokerClient , options ProxyOptions ) (io.Closer , error ) {
42
53
proxyDial := & proxyDial {
43
54
channelID : options .ChannelID ,
0 commit comments