You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is a socket library for reliable, high-performance messaging over in-process, IPC, TCP, WebSocket and secure TLS transports. Implements 'Scalability Protocols', a standard for common communications patterns including publish/subscribe, request/reply and service discovery.
10.[Options, Serialization and Statistics](#options-serialization-and-statistics)
30
-
31
-
### Cross-language Exchange
18
+
### 1. Cross-language Exchange
32
19
33
20
`nanonext` provides a fast, reliable data interface between different programming languages where NNG has an implementation, including C, C++, Java, Python, Go, and Rust.
34
21
@@ -82,9 +69,7 @@ n$recv(mode = "double")
82
69
n$close()
83
70
```
84
71
85
-
[« Back to ToC](#table-of-contents)
86
-
87
-
### Async and Concurrency
72
+
### 2. Async and Concurrency
88
73
89
74
`nanonext` implements true async send and receive, leveraging NNG as a massively-scalable concurrency framework.
90
75
@@ -162,9 +147,7 @@ close(s2)
162
147
163
148
```
164
149
165
-
[« Back to ToC](#table-of-contents)
166
-
167
-
### Synchronisation Primitives
150
+
### 3. Synchronisation Primitives
168
151
169
152
`nanonext` implements cross-platform synchronisation primitives from the NNG library, enabling synchronisation between NNG events and the main R execution thread.
170
153
@@ -232,9 +215,7 @@ When `flag = TRUE` is set for pipe notifications, `wait()` returns FALSE for pip
232
215
233
216
This mechanism enables waiting simultaneously on multiple events while distinguishing between them. `pipe_notify()` can signal up to two condition variables per event for additional flexibility in concurrent applications.
234
217
235
-
[« Back to ToC](#table-of-contents)
236
-
237
-
### TLS Secure Connections
218
+
### 4. TLS Secure Connections
238
219
239
220
Secure connections use NNG and Mbed TLS libraries. Enable them by:
240
221
@@ -270,9 +251,7 @@ close(s)
270
251
271
252
```
272
253
273
-
[« Back to ToC](#table-of-contents)
274
-
275
-
### Request Reply Protocol
254
+
### 5. Request Reply Protocol
276
255
277
256
`nanonext` implements remote procedure calls (RPC) using NNG's req/rep protocol for distributed computing. Use this for computationally-expensive calculations or I/O-bound operations in separate server processes.
278
257
@@ -318,9 +297,7 @@ For server-side operations (e.g., writing to disk), calling or querying the valu
318
297
319
298
The [`mirai`](https://doi.org/10.5281/zenodo.7912722) package (<https://mirai.r-lib.org/>) uses `nanonext` as the back-end to provide asynchronous execution of arbitrary R code using the RPC model.
320
299
321
-
[« Back to ToC](#table-of-contents)
322
-
323
-
### Publisher Subscriber Protocol
300
+
### 6. Publisher Subscriber Protocol
324
301
325
302
`nanonext` implements NNG's pub/sub protocol. Subscribers can subscribe to one or multiple topics broadcast by a publisher.
326
303
@@ -370,9 +347,7 @@ close(sub)
370
347
371
348
```
372
349
373
-
[« Back to ToC](#table-of-contents)
374
-
375
-
### Surveyor Respondent Protocol
350
+
### 7. Surveyor Respondent Protocol
376
351
377
352
Useful for service discovery and similar applications. A surveyor broadcasts a survey to all respondents, who may reply within a timeout period. Late responses are discarded.
378
353
@@ -415,9 +390,7 @@ close(res2)
415
390
416
391
The final value resolves to a timeout error (integer 5 classed as 'errorValue'). All error codes are classed as 'errorValue' for easy distinction from integer message values.
417
392
418
-
[« Back to ToC](#table-of-contents)
419
-
420
-
### ncurl: Async HTTP Client
393
+
### 8. ncurl: Async HTTP Client
421
394
422
395
`ncurl()` is a minimalist http(s) client. `ncurl_aio()` performs async requests, returning immediately with an 'ncurlAio'.
423
396
@@ -479,9 +452,7 @@ transact(sess)
479
452
480
453
```
481
454
482
-
[« Back to ToC](#table-of-contents)
483
-
484
-
### stream: Websocket Client
455
+
### 9. stream: Websocket Client
485
456
486
457
`stream()` exposes NNG's low-level byte stream interface for communicating with raw sockets, including arbitrary non-NNG endpoints.
487
458
@@ -519,9 +490,7 @@ close(s)
519
490
520
491
```
521
492
522
-
[« Back to ToC](#table-of-contents)
523
-
524
-
### Options, Serialization and Statistics
493
+
### 10. Options, Serialization and Statistics
525
494
526
495
Use `opt()` and `'opt<-'()` to get and set options on Sockets, Contexts, Streams, Listeners, or Dialers. See function documentation for available options.
10.[Options, Serialization and Statistics](#options-serialization-and-statistics)
23
-
24
-
### Cross-language Exchange
11
+
### 1. Cross-language Exchange
25
12
26
13
`nanonext` provides a fast, reliable data interface between different programming languages where NNG has an implementation, including C, C++, Java, Python, Go, and Rust.
27
14
@@ -78,9 +65,7 @@ n$recv(mode = "double")
78
65
n$close()
79
66
```
80
67
81
-
[« Back to ToC](#table-of-contents)
82
-
83
-
### Async and Concurrency
68
+
### 2. Async and Concurrency
84
69
85
70
`nanonext` implements true async send and receive, leveraging NNG as a massively-scalable concurrency framework.
86
71
@@ -166,9 +151,7 @@ close(s2)
166
151
167
152
```
168
153
169
-
[« Back to ToC](#table-of-contents)
170
-
171
-
### Synchronisation Primitives
154
+
### 3. Synchronisation Primitives
172
155
173
156
`nanonext` implements cross-platform synchronisation primitives from the NNG library, enabling synchronisation between NNG events and the main R execution thread.
174
157
@@ -244,9 +227,7 @@ When `flag = TRUE` is set for pipe notifications, `wait()` returns FALSE for pip
244
227
245
228
This mechanism enables waiting simultaneously on multiple events while distinguishing between them. `pipe_notify()` can signal up to two condition variables per event for additional flexibility in concurrent applications.
246
229
247
-
[« Back to ToC](#table-of-contents)
248
-
249
-
### TLS Secure Connections
230
+
### 4. TLS Secure Connections
250
231
251
232
Secure connections use NNG and Mbed TLS libraries. Enable them by:
252
233
@@ -266,7 +247,7 @@ The convenience function `write_cert()` generates a 4096-bit RSA key pair and se
`nanonext` implements remote procedure calls (RPC) using NNG's req/rep protocol for distributed computing. Use this for computationally-expensive calculations or I/O-bound operations in separate server processes.
295
274
@@ -327,7 +306,7 @@ When the result is needed, call the recvAio using `call_aio()` to retrieve the v
327
306
328
307
```r
329
308
call_aio(aio)$data|> str()
330
-
#> num [1:100000000] -1.0996 -0.068 -1.2462 -0.5909 -0.0194 ...
309
+
#> num [1:100000000] -1.532 -1.493 0.499 0.478 -0.118 ...
331
310
```
332
311
333
312
Since `call_aio()` blocks, alternatively query `aio$data` directly, which returns 'unresolved' (logical NA) if incomplete.
@@ -336,9 +315,7 @@ For server-side operations (e.g., writing to disk), calling or querying the valu
336
315
337
316
The [`mirai`](https://doi.org/10.5281/zenodo.7912722) package (<https://mirai.r-lib.org/>) uses `nanonext` as the back-end to provide asynchronous execution of arbitrary R code using the RPC model.
338
317
339
-
[« Back to ToC](#table-of-contents)
340
-
341
-
### Publisher Subscriber Protocol
318
+
### 6. Publisher Subscriber Protocol
342
319
343
320
`nanonext` implements NNG's pub/sub protocol. Subscribers can subscribe to one or multiple topics broadcast by a publisher.
344
321
@@ -403,9 +380,7 @@ close(sub)
403
380
404
381
```
405
382
406
-
[« Back to ToC](#table-of-contents)
407
-
408
-
### Surveyor Respondent Protocol
383
+
### 7. Surveyor Respondent Protocol
409
384
410
385
Useful for service discovery and similar applications. A surveyor broadcasts a survey to all respondents, who may reply within a timeout period. Late responses are discarded.
411
386
@@ -454,9 +429,7 @@ close(res2)
454
429
455
430
The final value resolves to a timeout error (integer 5 classed as 'errorValue'). All error codes are classed as 'errorValue' for easy distinction from integer message values.
456
431
457
-
[« Back to ToC](#table-of-contents)
458
-
459
-
### ncurl: Async HTTP Client
432
+
### 8. ncurl: Async HTTP Client
460
433
461
434
`ncurl()` is a minimalist http(s) client. `ncurl_aio()` performs async requests, returning immediately with an 'ncurlAio'.
`stream()` exposes NNG's low-level byte stream interface for communicating with raw sockets, including arbitrary non-NNG endpoints.
557
528
@@ -599,9 +570,7 @@ close(s)
599
570
600
571
```
601
572
602
-
[« Back to ToC](#table-of-contents)
603
-
604
-
### Options, Serialization and Statistics
573
+
### 10. Options, Serialization and Statistics
605
574
606
575
Use `opt()` and `'opt<-'()` to get and set options on Sockets, Contexts, Streams, Listeners, or Dialers. See function documentation for available options.
0 commit comments