Skip to content

Commit e94dce8

Browse files
committed
feat: Introduce per-Link*() hooks to Go and TypeScript versions that allow associating a specific call to Link*() with a remoteID
1 parent 6a6b3c0 commit e94dce8

24 files changed

Lines changed: 150 additions & 48 deletions

File tree

  • go
    • cmd
      • panrpc-example-callbacks-callee-cli
      • panrpc-example-callbacks-caller-cli
      • panrpc-example-closures-callee-cli
      • panrpc-example-closures-caller-cli
      • panrpc-example-pipe-client-cli
      • panrpc-example-pipe-server-cli
      • panrpc-example-redis-client-cli
      • panrpc-example-redis-server-cli
      • panrpc-example-tcp-client-cli
      • panrpc-example-tcp-rps-client-cli
      • panrpc-example-tcp-rps-server-cli
      • panrpc-example-tcp-server-cli
      • panrpc-example-tcp-throughput-client-cli
      • panrpc-example-tcp-throughput-server-cli
      • panrpc-example-unix-client-cli
      • panrpc-example-unix-server-cli
      • panrpc-example-webrtc-peer-cli
      • panrpc-example-websocket-client-cli
      • panrpc-example-websocket-coffee-client-cli
      • panrpc-example-websocket-coffee-server-cli
      • panrpc-example-websocket-server-cli
    • pkg/rpc
  • ts/src/rpc

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func main() {
175175

176176
ctx,
177177

178-
&rpc.Options{
178+
&rpc.RegistryHooks{
179179
OnClientConnect: func(remoteID string) {
180180
clients++
181181

@@ -359,7 +359,7 @@ func main() {
359359

360360
ctx,
361361

362-
&rpc.Options{
362+
&rpc.RegistryHooks{
363363
OnClientConnect: func(remoteID string) {
364364
clients++
365365

@@ -633,7 +633,7 @@ func main() {
633633

634634
ctx,
635635

636-
&rpc.Options{
636+
&rpc.RegistryHooks{
637637
OnClientConnect: func(remoteID string) {
638638
clients++
639639

@@ -674,7 +674,7 @@ func main() {
674674

675675
ctx,
676676

677-
&rpc.Options{
677+
&rpc.RegistryHooks{
678678
OnClientConnect: func(remoteID string) {
679679
clients++
680680

go/cmd/panrpc-example-callbacks-callee-cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func main() {
5959

6060
ctx,
6161

62-
&rpc.Options{
62+
&rpc.RegistryHooks{
6363
OnClientConnect: func(remoteID string) {
6464
clients++
6565

@@ -124,6 +124,8 @@ func main() {
124124
func(data json.RawMessage, v any) error {
125125
return json.Unmarshal([]byte(data), v)
126126
},
127+
128+
nil,
127129
); err != nil {
128130
panic(err)
129131
}
@@ -161,6 +163,8 @@ func main() {
161163
func(data json.RawMessage, v any) error {
162164
return json.Unmarshal([]byte(data), v)
163165
},
166+
167+
nil,
164168
); err != nil {
165169
panic(err)
166170
}

go/cmd/panrpc-example-callbacks-caller-cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func main() {
4040

4141
ctx,
4242

43-
&rpc.Options{
43+
&rpc.RegistryHooks{
4444
OnClientConnect: func(remoteID string) {
4545
clients++
4646

@@ -152,6 +152,8 @@ func main() {
152152
func(data json.RawMessage, v any) error {
153153
return json.Unmarshal([]byte(data), v)
154154
},
155+
156+
nil,
155157
); err != nil {
156158
panic(err)
157159
}
@@ -189,6 +191,8 @@ func main() {
189191
func(data json.RawMessage, v any) error {
190192
return json.Unmarshal([]byte(data), v)
191193
},
194+
195+
nil,
192196
); err != nil {
193197
panic(err)
194198
}

go/cmd/panrpc-example-closures-callee-cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func main() {
4646

4747
ctx,
4848

49-
&rpc.Options{
49+
&rpc.RegistryHooks{
5050
OnClientConnect: func(remoteID string) {
5151
clients++
5252

@@ -110,6 +110,8 @@ func main() {
110110
func(data json.RawMessage, v any) error {
111111
return json.Unmarshal([]byte(data), v)
112112
},
113+
114+
nil,
113115
); err != nil {
114116
panic(err)
115117
}
@@ -147,6 +149,8 @@ func main() {
147149
func(data json.RawMessage, v any) error {
148150
return json.Unmarshal([]byte(data), v)
149151
},
152+
153+
nil,
150154
); err != nil {
151155
panic(err)
152156
}

go/cmd/panrpc-example-closures-caller-cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func main() {
4141

4242
ctx,
4343

44-
&rpc.Options{
44+
&rpc.RegistryHooks{
4545
OnClientConnect: func(remoteID string) {
4646
clients++
4747

@@ -161,6 +161,8 @@ func main() {
161161
func(data json.RawMessage, v any) error {
162162
return json.Unmarshal([]byte(data), v)
163163
},
164+
165+
nil,
164166
); err != nil {
165167
panic(err)
166168
}
@@ -198,6 +200,8 @@ func main() {
198200
func(data json.RawMessage, v any) error {
199201
return json.Unmarshal([]byte(data), v)
200202
},
203+
204+
nil,
201205
); err != nil {
202206
panic(err)
203207
}

go/cmd/panrpc-example-pipe-client-cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737

3838
ctx,
3939

40-
&rpc.Options{
40+
&rpc.RegistryHooks{
4141
OnClientConnect: func(remoteID string) {
4242
clients++
4343

@@ -128,6 +128,8 @@ func main() {
128128
func(data json.RawMessage, v any) error {
129129
return json.Unmarshal([]byte(data), v)
130130
},
131+
132+
nil,
131133
); err != nil {
132134
panic(err)
133135
}

go/cmd/panrpc-example-pipe-server-cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737

3838
ctx,
3939

40-
&rpc.Options{
40+
&rpc.RegistryHooks{
4141
OnClientConnect: func(remoteID string) {
4242
clients++
4343

@@ -100,6 +100,8 @@ func main() {
100100
func(data json.RawMessage, v any) error {
101101
return json.Unmarshal([]byte(data), v)
102102
},
103+
104+
nil,
103105
); err != nil {
104106
panic(err)
105107
}

go/cmd/panrpc-example-redis-client-cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func main() {
5757

5858
ctx,
5959

60-
&rpc.Options{
60+
&rpc.RegistryHooks{
6161
OnClientConnect: func(remoteID string) {
6262
clients++
6363

@@ -268,6 +268,8 @@ func main() {
268268
func(data json.RawMessage, v any) error {
269269
return json.Unmarshal([]byte(data), v)
270270
},
271+
272+
nil,
271273
); err != nil {
272274
panic(err)
273275
}

go/cmd/panrpc-example-redis-server-cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func main() {
5757

5858
ctx,
5959

60-
&rpc.Options{
60+
&rpc.RegistryHooks{
6161
OnClientConnect: func(remoteID string) {
6262
clients++
6363

@@ -255,6 +255,8 @@ func main() {
255255
func(data json.RawMessage, v any) error {
256256
return json.Unmarshal([]byte(data), v)
257257
},
258+
259+
nil,
258260
); err != nil {
259261
panic(err)
260262
}

go/cmd/panrpc-example-tcp-client-cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func main() {
4343

4444
ctx,
4545

46-
&rpc.Options{
46+
&rpc.RegistryHooks{
4747
OnClientConnect: func(remoteID string) {
4848
clients++
4949

@@ -155,6 +155,8 @@ func main() {
155155
func(data json.RawMessage, v any) error {
156156
return json.Unmarshal([]byte(data), v)
157157
},
158+
159+
nil,
158160
); err != nil {
159161
panic(err)
160162
}
@@ -192,6 +194,8 @@ func main() {
192194
func(data json.RawMessage, v any) error {
193195
return json.Unmarshal([]byte(data), v)
194196
},
197+
198+
nil,
195199
); err != nil {
196200
panic(err)
197201
}

0 commit comments

Comments
 (0)