@@ -206,7 +206,7 @@ call_aio(aio)
206206aio
207207# > < recvAio | $data >
208208aio $ data | > str()
209- # > num [1:100000000] -0.9504 -0.9926 -0.015 0.0319 0.9306 ...
209+ # > num [1:100000000] -1.405 0.658 0.991 0.615 1.78 ...
210210```
211211
212212As ` call_aio() ` is blocking and will wait for completion, an alternative is to query ` aio$data ` directly. This will return an 'unresolved' logical NA value if the calculation is yet to complete.
@@ -325,7 +325,7 @@ Additionally, the convenience function `write_cert()` can automatically generate
325325cert <- write_cert(cn = " 127.0.0.1" )
326326str(cert )
327327# > List of 2
328- # > $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJKgIBAAKCAgEArOkChHl0yUMW+4UT44pGJSvCp4ejQ4lyCNMzOLzs8ota2qH0\npliEjesxv3Y8 "| __truncated__
328+ # > $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJJwIBAAKCAgEAwKtfMkgvkLkIQmiki/vsP4/8ToUCDOmrl2K/J+C5hZm18aBy\n2iKA6x2WHm38 "| __truncated__
329329# > $ client: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ ""
330330
331331ser <- tls_config(server = cert $ server )
@@ -483,7 +483,7 @@ ncurl("https://postman-echo.com/get")
483483# > NULL
484484# >
485485# > $data
486- # > [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-659e628a-051f02da266430d33ca79bad \"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
486+ # > [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-659eac88-7aeb17424a64ed276158be7f \"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
487487```
488488
489489For advanced use, supports additional HTTP methods such as POST or PUT.
@@ -500,10 +500,10 @@ res
500500
501501call_aio(res )$ headers
502502# > $date
503- # > [1] "Wed, 10 Jan 2024 09:25:31 GMT"
503+ # > [1] "Wed, 10 Jan 2024 14:41:12 GMT"
504504
505505res $ data
506- # > [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-659e628a-7ab5f14023fce74710bbee51 \",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
506+ # > [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-659eac88-7a682ad249d92cd61c497f38 \",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
507507```
508508
509509In this respect, it may be used as a performant and lightweight method for making REST API requests.
@@ -527,7 +527,7 @@ transact(sess)
527527# >
528528# > $headers
529529# > $headers$Date
530- # > [1] "Wed, 10 Jan 2024 09:25:31 GMT"
530+ # > [1] "Wed, 10 Jan 2024 14:41:13 GMT"
531531# >
532532# > $headers$`Content-Type`
533533# > [1] "application/json; charset=utf-8"
@@ -538,7 +538,7 @@ transact(sess)
538538# > [41] 72 77 61 72 64 65 64 2d 70 72 6f 74 6f 22 3a 20 22 68 74 74 70 73 22 2c 0a 20 20 20 20 22 78 2d 66 6f 72 77 61 72 64 65
539539# > [81] 64 2d 70 6f 72 74 22 3a 20 22 34 34 33 22 2c 0a 20 20 20 20 22 68 6f 73 74 22 3a 20 22 70 6f 73 74 6d 61 6e 2d 65 63 68
540540# > [121] 6f 2e 63 6f 6d 22 2c 0a 20 20 20 20 22 78 2d 61 6d 7a 6e 2d 74 72 61 63 65 2d 69 64 22 3a 20 22 52 6f 6f 74 3d 31 2d 36
541- # > [161] 35 39 65 36 32 38 62 2d 37 66 38 32 36 39 63 33 30 64 63 35 36 34 37 61 34 61 31 39 35 36 32 65 22 2c 0a 20 20 20 20 22
541+ # > [161] 35 39 65 61 63 38 39 2d 32 36 37 34 36 66 35 63 34 65 61 36 64 35 32 39 36 33 33 34 36 39 30 31 22 2c 0a 20 20 20 20 22
542542# > [201] 63 6f 6e 74 65 6e 74 2d 74 79 70 65 22 3a 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 22 2c 0a 20 20 20 20 22
543543# > [241] 61 75 74 68 6f 72 69 7a 61 74 69 6f 6e 22 3a 20 22 42 65 61 72 65 72 20 41 50 49 4b 45 59 22 0a 20 20 7d 2c 0a 20 20 22
544544# > [281] 75 72 6c 22 3a 20 22 68 74 74 70 73 3a 2f 2f 70 6f 73 74 6d 61 6e 2d 65 63 68 6f 2e 63 6f 6d 2f 67 65 74 22 0a 7d
@@ -558,10 +558,9 @@ The stream interface can be used to communicate with (secure) websocket servers.
558558s <- stream(dial = " wss://echo.websocket.events/" , textframes = TRUE )
559559s
560560# > < nanoStream >
561- # > - mode: dialer
561+ # > - mode: dialer text frames
562562# > - state: opened
563563# > - url: wss://echo.websocket.events/
564- # > - textframes: TRUE
565564```
566565
567566` send() ` and ` recv() ` , as well as their asynchronous counterparts ` send_aio() ` and ` recv_aio() ` can be used on Streams in the same way as Sockets. This affords a great deal of flexibility in ingesting and processing streaming data.
0 commit comments