{"_id":"@async-cancellables/async-simple-rpc","_rev":"4-2aac1ce181e35552af5233bf099c6014","name":"@async-cancellables/async-simple-rpc","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"@async-cancellables/async-simple-rpc","version":"0.1.0","description":"Asynchronous RPC with cancellation support","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"author":{"name":"vuwuv"},"license":"MIT","bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"homepage":"https://github.com/vuwuv/async-cancellables#readme","engines":{"node":">=18.0.0"},"dependencies":{"@async-cancellables/ct":"^2.2.1"},"peerDependencies":{"socket.io":"^4.6.1","socket.io-client":"^4.6.1"},"gitHead":"a85312106999493278409fdf9c14455f42cfbcf3","_id":"@async-cancellables/async-simple-rpc@0.1.0","_nodeVersion":"18.15.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-qnvMh41eGuV2+dZur5aZ8oMBWdqojoo9bY+WbTGwrn72KNmcZ19g1BY/kzdyOKg89jI1PrfvfEonvc4/aax0LQ==","shasum":"beae377c6e9347eff833995cb8f4c8f82eadc2c6","tarball":"https://registry.npmjs.org/@async-cancellables/async-simple-rpc/-/async-simple-rpc-0.1.0.tgz","fileCount":6,"unpackedSize":18981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+p2dOubHHLYIsrqXtRZDGKx9jQL2uOIL0z6J61a1ADQIgf2YXHoVtZkqCXTKDNZUaKsFywQkQVIYBXq7lXVFUozQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHsQlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFgQ/8C2JmyG84xkkjEtwMScdFF1ayH/TO1+7NZQKXtIXmZCotRuny\r\nADR8J8aC3SGSZOr9nsYXggy10xeH1X7x+l3zmPvFc6kcFZ6ou8/fumSEu5P7\r\nDodNBJVUyoojMo2GjDDxLjeHnaOVSBNs78S6fdzW9j6R3oUEhIvmqWvw8L6M\r\nFApfJosatwSF2ON5tm1gd5tt5VJ5tkiQRsEoR5BVp/E8xJ5ifaQ8gjjlVw7L\r\n8y/BYkUCWNyox0DLcEbfdlhaAIPJYKMS4E/cFpzE08M7Z6eQ21+Eto8k5+HK\r\naVVme2AsJonXWVesHcluIWMTGL6SYwhVFgfEOuqtfPrT71xNGlUaRMT8qY18\r\n2/CaVRj4DCC7kwsV2+BR8DAgcGFGtwnnGEAPv2XbsS+B4//AL4m8Hk7QT9PJ\r\nTLsAOu+vcG/nmQzZ03YdJ+IOFtVFBKtXUBkDsdR87q5h14lHRSMyrMSMMUf4\r\nyLizrN2msr7JaB5RyRcBP9Gt6Cw58lNX4kWRM6dSQJjux+GiEkHl31gsoPyB\r\njH74BXulDE09fGt+CTZ6NQucxd7M763h95AhbR8NRQAoAoPldJvadX0rcFp9\r\nKMNgPNx7UInb+0Gkm44WwvTnF00t8m+51FBUV9ta3YvRKRoJVn57+tnpkD3a\r\nAMFc1vPDNArZFDQZVbmy5pgcd0rezV2suBQ=\r\n=YOdm\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vuwuv","email":"vkhubb@gmail.com"},"directories":{},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-simple-rpc_0.1.0_1679737893103_0.3747269059908096"},"_hasShrinkwrap":false},"0.2.0":{"name":"@async-cancellables/async-simple-rpc","version":"0.2.0","description":"Asynchronous RPC with cancellation support","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"author":{"name":"vuwuv"},"license":"MIT","bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"homepage":"https://github.com/vuwuv/async-cancellables#readme","engines":{"node":">=18.0.0"},"dependencies":{"@async-cancellables/ct":"^2.3.0"},"peerDependencies":{"socket.io":"^4.6.1","socket.io-client":"^4.6.1"},"gitHead":"a85312106999493278409fdf9c14455f42cfbcf3","_id":"@async-cancellables/async-simple-rpc@0.2.0","_nodeVersion":"18.15.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-9874EzhZHSDHEN/FLcCDJ5+q+eqXPC9Bp8ZP1PiFjLsGvP5GtUJ2uVmEKbwH+d51pPIXegJNtuAO9DlI7CRI7A==","shasum":"7cc80d2b4d55ac9db8349245c76d092087a71aa3","tarball":"https://registry.npmjs.org/@async-cancellables/async-simple-rpc/-/async-simple-rpc-0.2.0.tgz","fileCount":6,"unpackedSize":20553,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICJYDPTZhJfM1WbFOZu3aQyLOtCUXNcfNbjukhlCYTRGAiEAnWyFtbSKLf4/z0NOgACc03VkZkSvCj6SNhbgr2o/C0I="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJdR/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFpQ/+MF+nkrINOdA/GsXBL+juCvnIxREXhZufnFcFaoUqHmTQRkMd\r\nLtctebNuKbGAPW2W1zewutE7y0PZh/XI8TLjLroUSb2TMIrTy/4SsfpceyAn\r\nap2Xa+iWTaDvpHw6BrkYhHe8lZEaORsc6vJfwAzKXaBNuSmOKoSWOqO28DCw\r\npeR/lSp6mgBe+FZ4zbOuB6MNRHEFaQON22n4y4flrAWkQflVA76kBDYEIG4z\r\n4AOQcsvJOvSSXppNY8SMIPkuluE1b4upV2PJOcn7sqe4J8MwbROhAL1VpPk+\r\ny5KgyzIWSaa0B0fvhmUBOzOV17tifUC8YYXks4UOt0xO2XhVFX49tVJVMT8t\r\nClJjLS4K8oGXNkOFqB9q6YmNa0/8D7LzfXJzIaVcJR2duvszt69QVrTdkmAl\r\nLwj2qOyCOIhuhHE8j7q+n77txCLscvfC8gZh1UUd/sztLO46HD1qbT4FtN52\r\nXwHG/UubZuA0XDj2gYr+iJWVniZzN0/lJoUY6el8Q1IGTzYGpigbo8L45ffy\r\nklXdgSRMnyXF/Yjfdul2dNlXnIXL/bmFPwJr9GXBb0BCjdpd3Vxwnc+PQvxY\r\njXmTwgYqMbfU5JSzrMo6KRpzeg/3W6FlOACgkkU9btW+iVlX4QWJ7SB8xtnT\r\nB9Be/AhFcefXc2AMWcnACH/L0MqWYHABCtw=\r\n=HlmN\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vuwuv","email":"vkhubb@gmail.com"},"directories":{},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-simple-rpc_0.2.0_1680200831371_0.9973980567086727"},"_hasShrinkwrap":false},"0.3.0":{"name":"@async-cancellables/async-simple-rpc","version":"0.3.0","description":"Asynchronous RPC with cancellation support","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"author":{"name":"vuwuv"},"license":"MIT","bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"homepage":"https://github.com/vuwuv/async-cancellables#readme","engines":{"node":">=18.0.0"},"dependencies":{"@async-cancellables/ct":"^2.3.0"},"peerDependencies":{"socket.io":"^4.6.1","socket.io-client":"^4.6.1"},"gitHead":"10a238c018e8af11454a0258293bbc1600828c93","_id":"@async-cancellables/async-simple-rpc@0.3.0","_nodeVersion":"18.15.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-WHn7QHQ0+xgEcEv3gx6zZHAczXttZeGudJqe50hG357BQT929Py10mBm/VDNEbEeYUeIEmLD5eVCFpMCCe50Mw==","shasum":"b940015af3ab204d8fd6d7b08d189b0bde36ce96","tarball":"https://registry.npmjs.org/@async-cancellables/async-simple-rpc/-/async-simple-rpc-0.3.0.tgz","fileCount":6,"unpackedSize":20919,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKu1R7HaoacGSz56yS8SBruaIGNymHFjd759jziMFEVQIhAKdyUXwqH8j56+IUaijFfK+qRjhwZ6HViPQCuS76h8+G"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJpjNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYuQ//XAbSc0v/rc4HChBPRBFVShmf6N4ckivGqwsvm48vp0k3a1jT\r\ni6l7y6LwlXO3EKj9P4HRhaHVOrrSs2KuNhCqgzfGGu99OJxinhdPxayflnEl\r\npkuabIrtKKfcAjY5ppHnI1ciqtck8aAzaFAMayE4UxPjT8qsd+PW8WpJi1oG\r\nGgrYXu15Qhe23luyXWu0Z0YrSDBqqGz5WvBatTqY3bBlEhcNZtHe4/Hm5qlC\r\nxDybevG0Z8382Ee8K74wyOs5wJkD7pdu1AY/+Zkl+3Eh61ei8UGIl243HJYq\r\nPtyU+PxpOQWSJjIH1MXoTzBK+ljljKMILVMsq8kPV6cOj0bW4fztq7h+h9jv\r\n61LdPXpCXjwOkpK+preYV7nz07gq9TwNqZtEHsyu6DnArTNDWAGhslbiguY+\r\ndlZiLK81l6oD7HSV7Jbrxq4Xy35/KckHT28M5ABu3oRyzIT4Z4g0NsJ4eRG4\r\ngl8X4aFN86Ctim2z+c4VsCjxV7aWZmuRtAFOexibyLz1QxxLvNdJwH3ZZ/jv\r\n8xa+dlvNsGa5kgY3tAzPxfFnETCkYLkTGbF4NM+K8Z1K7Av0Bo6AMJL7Hyny\r\ngKP0CTj8d/Lbw0O9LdnKLOGiEr1rph5bDMs2C/OdO+LrP0LbIC37IdVDS+RN\r\nnmvEEpqhq4Ku7dq2QYWl1kwR4rHRYVG+BYs=\r\n=O+Nb\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vuwuv","email":"vkhubb@gmail.com"},"directories":{},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-simple-rpc_0.3.0_1680251085148_0.7037942905450751"},"_hasShrinkwrap":false},"0.3.1":{"name":"@async-cancellables/async-simple-rpc","version":"0.3.1","description":"Asynchronous RPC with cancellation support","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"author":{"name":"vuwuv"},"license":"MIT","bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"homepage":"https://github.com/vuwuv/async-cancellables#readme","engines":{"node":">=18.0.0"},"dependencies":{"@async-cancellables/ct":"^2.3.0"},"peerDependencies":{"socket.io":"^4.6.1","socket.io-client":"^4.6.1"},"gitHead":"7b57db5da983b557ecbe39effdd043b429cee91a","_id":"@async-cancellables/async-simple-rpc@0.3.1","_nodeVersion":"18.15.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-01cqLa0XYu9/rSswzEnzO20qX2ZYQgJitvlFenLHqk77HK1XKujHXov8uzJNucNh1nfAeaIjl3UerIrTATsu/w==","shasum":"9c8c9a32bccc0a83d9138d84c7421d96d2d7962b","tarball":"https://registry.npmjs.org/@async-cancellables/async-simple-rpc/-/async-simple-rpc-0.3.1.tgz","fileCount":6,"unpackedSize":20911,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHvxWn+n+mvJoe9wS1DeSroYr3dUAXBSl3Ol8l0oDVtwAiBnzoiLTg//6uVYCGEVHtdR0APQ73uKO9LCxLF2NiPyuw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJqi0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpByA//RGyYr83G+GNSenraXUOLSuRfSMv8OuPYiXs4BYO884b4pXB9\r\nU1iA503ZWFQbWktMSGKkBkNGVB24P8dN61GI7AE9/eHRyQEgYKSq63LLEqB9\r\n6wtSap72icLL83N31Pwo/E2W+t+7GTgobKd1Kn0iug6of9KePM2g/nTuwVoR\r\nOE5SVYXRG+uZZsRItrrfnNiO1p+fjHRKoNZbUg0C8SuAnmyd5sezX5gAIPTT\r\nIe2i9Cc/R7qIou8s2VXfRMMspShLgTwUg//D3TlnENksuuiJ1wARiO/X3xTa\r\nkkDZUBPCdoW8WgKGEjVQZATgYYbIb/yPwf3Z0m3/+MZnKHIdIERDvFxc0HHx\r\nXkeuSaRIr6P8izdjSm6Rc9Bsc0QIJCmLpEzhbOSFS7ZjOfi9DD7VyJiedXXQ\r\nBJTQi4z/Rnto/NOc0q3hd1z5miOi6vvNePdNdbHLWYNIl6WsPDmlt0rddQI6\r\n7tEpdYVJ8oqEdjGrgEaOMeJKq8a0pmbLKHD9XS4gEudFLKrmpdyLJn9jFb7N\r\nVlhuTczJMv8nlAxxM7Ze+igOK16shnP/LVmqgvqIJA1eWi5rM4ZEigMkNEwR\r\nQZsx5TXRJT9oEzxvMAZRjfwTtE0bPg73HByX1OitVo7ABTm2I6iP5QLGJtdd\r\nwwD2BcY/uUobWqVlVCoR+F2NN4XzBKFDxW4=\r\n=aoET\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vuwuv","email":"vkhubb@gmail.com"},"directories":{},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-simple-rpc_0.3.1_1680255156012_0.8428567125680542"},"_hasShrinkwrap":false},"0.3.2":{"name":"@async-cancellables/async-simple-rpc","version":"0.3.2","description":"Asynchronous RPC with cancellation support","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"author":{"name":"vuwuv"},"license":"MIT","bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"homepage":"https://github.com/vuwuv/async-cancellables#readme","engines":{"node":">=18.0.0"},"dependencies":{"@async-cancellables/ct":"^2.3.0"},"peerDependencies":{"socket.io":"^4.6.1","socket.io-client":"^4.6.1"},"gitHead":"46521a331d231ad0ca3cd71b2df76d9781a8ec85","_id":"@async-cancellables/async-simple-rpc@0.3.2","_nodeVersion":"18.15.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-Fto/yRQrex+H+6xzHPC9YVeUT2l5pbLV9CDmBWdSK9oDY//kaJcW2QG2GOAZkJs2Iqju5yo4J7Asw0LkYL5fOw==","shasum":"d1f25ed124b4cd3b2ded2c32ee386f7a1550ba01","tarball":"https://registry.npmjs.org/@async-cancellables/async-simple-rpc/-/async-simple-rpc-0.3.2.tgz","fileCount":6,"unpackedSize":21414,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEHkcU59m/DqOPbz08XxRH8ymo0+9Zft7Pzj8ycTMbPIAiEA7I2Wcng71/8oWzIYPOxYsLfq6cX181rJmcMoWLOqDn4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJv+dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoC/Q/+I9xYz34lIUlK9EwMJqZqqdvl+F0Z8IXAwahoiyciA54IoOnd\r\n2wGnt02F9xypb602wfAIvPysP2pQBGWLQpZJlmCLNgTTERwZtJl9yet8Y9Xs\r\nIljUnOgy6ExgTl8TqhZDnDUkNlDlS1YSIeKn1Xp5xniDtnCDG4ueSDCzO69t\r\netVSbmeLQ1h3DWaFGBuFmY1d0XiDsvqO2P2DjO2AZjCUxuJ8G+s5Wy6pmnOj\r\nQD8FNzwR+YFp0lXs8sXzN5FHye+Ae2RvO58h+x2dwXHY0x54es9g6cIkbDza\r\n4JySF9o3xLlZeZCoJOqPWE7J0V+bArpgzr896ArO3MyGBvjqBzoJEmrjJANL\r\nwql5dEHxhtVtCVPmg/L3bHS7bO3UB/L8E8Lcopd66VPECein1feVOXuEUJQo\r\nGUz5GQlsgxFWGF0ffPWTDDZGloZlQAzxAgM3oOPIrSyG48EUKQv4lWdm6Lxz\r\nAJG60LD1o5ViTYBzhmfp16qQfQura5Qtmxo73MUQL12cOjkEyJcJ1+vSWq/x\r\nhyYzmhCE4v4lRWbW1fx6C2xVmZ28NYpa2+5ff/r4o/cTbmhmUE8ZhLegjXcF\r\nnwA3L8MjKHMab9yhm4lZcngQL2R+bHRMyURtspWzXkP+9i7r95u/MzYdqkym\r\nDubuCC1Y85fWCIEhB/KjjtJw54gCPiIiR/4=\r\n=6PpB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vuwuv","email":"vkhubb@gmail.com"},"directories":{},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-simple-rpc_0.3.2_1680277405083_0.6976699705228384"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-25T09:51:33.028Z","0.1.0":"2023-03-25T09:51:33.234Z","modified":"2023-03-31T15:43:25.450Z","0.2.0":"2023-03-30T18:27:11.541Z","0.3.0":"2023-03-31T08:24:45.292Z","0.3.1":"2023-03-31T09:32:36.174Z","0.3.2":"2023-03-31T15:43:25.338Z"},"maintainers":[{"name":"vuwuv","email":"vkhubb@gmail.com"}],"description":"Asynchronous RPC with cancellation support","homepage":"https://github.com/vuwuv/async-cancellables#readme","keywords":["async","cancellable","rpc","AsyncRpcClient","AsyncRpcServer","cancellation"],"repository":{"type":"git","url":"git+https://github.com/vuwuv/async-cancellables.git","directory":"packages/async-simple-rpc"},"author":{"name":"vuwuv"},"bugs":{"url":"https://github.com/vuwuv/async-cancellables/issues"},"license":"MIT","readme":"# Async Cancellables / AsyncSimpleRpc\n\n> Asynchronous remote function calls with cancellation support via socket.io\n\n## Table of contents\n\n-   [Prerequisites](#prerequisites)\n-   [Table of contents](#table-of-contents)\n-   [Installation](#installation)\n-   [API](#api)\n    -   [Remote resource](#remote-resource)\n    -   [Creating server](#creating-server)\n    -   [Creating client](#creating-client)\n    -   [Calling remote methods](#calling-remote-methods)\n    -   [Releasing remote resources](#releasing-remote-resources)\n    -   [Misc client methods and properties](#misc-client-methods-and-properties)\n    -   [Misc server methods and properties](#misc-server-methods-and-properties)\n    -   [Events](#events)\n    -   [Client error markers](#client-error-markers)\n-   [Authors](#authors)\n-   [License](#license)\n\n## Prerequisites\n\nThis project requires NodeJS (version 18 or later) and NPM.\n\n## Installation\n\nTo install and set up the library, run:\n\n```sh\n$ npm install @async-cancellables/async-simple-rpc\n```\n\n## Example\n\nThe following example downloads a list of files having no more than 2 concurrent downloads\n\n```js\nimport { Server } from 'socket.io';\nimport Client from 'socket.io-client';\nimport { createServer } from 'http';\nimport { AsyncRpcServer, AsyncRpcClient } from '@async-cancellables/async-simple-rpc';\nimport { AsyncLock, AsyncLockTicket } from '@async-cancellables/async-lock';\nimport AsyncCooldownQueue from '@async-cancellables/async-cooldown-queue';\nimport CT from '@async-cancellables/ct';\n\nconst namespace = '/__asyncSimpleRpc';\nconst url = `http://127.0.0.1:8080${namespace}`;\n\nconst asyncLock = new AsyncLock(2);\nconst asyncCooldownQueue = new AsyncCooldownQueue(1000);\n\nconst methods = {\n    add: (a, b) => a + b,\n    lock: async (ct, slotCount) => asyncLock.wait(slotCount, ct),\n    wait: async (ct) => asyncCooldownQueue.wait(ct),\n};\n\nconst httpServer = createServer();\nhttpServer.listen(8080);\n\nconst socketServer = new Server(httpServer);\nconst asyncRpcServer = AsyncRpcServer.socketio(socketServer.of(namespace), methods, { resourceClasses: [AsyncLockTicket, 'release'] });\nconst asyncRpcClient = AsyncRpcClient.socketio(Client(url));\n\nlet sum = await asyncRpcClient.add(CT.manual(), 1, 2); // 3\nlet ticket = await asyncRpcClient.lock(CT.manual(), 1); // acquire remote lock, returns AsyncRpcRemoteResource\nawait ticket.waitRelease(); // wait for remote lock release\nawait asyncRpcClient.wait(CT.manual()); // wait for cooldown\n```\n\n## API\n\n### Remote resource\n\nRemote resource is a class that represents remote resource and provides methods to release it. Example of such resource is `AsyncLockTicket` which represents lock ticket. To release slots occupied by the ticket you should call `release()` method of the ticket, so other waiters can acquire these slots.\n\n### Creating server\n\nAsyncRpcServer requires socket.io server instance and methods to be exposed, also you may specify resource classes list and their release method names.\n`AsyncRpcServer.socketio(socketServer, methods, options)` method creates AsyncRpcServer instance and exposes methods to socket.io server instance: \n    - `socketServer` socket.io server instance \n    - `methods` is an object with methods to be exposed \n    - `options` is an object with options: \n        - `resourceClasses` is a mixed array of resource classes and their release method names or a respective `Map`\n\nMethods can be regular or async functions. If it is an async function, it the first parameter should receive a `CancellationToken` instance.\n\n```js\nconst asyncRpcServer = AsyncRpcServer.socketio(\n    socketServer, \n    {\n        add: (a, b) => a + b,\n        wait: async (ct, time) => CT.sleep(time, ct),\n    }, \n    { \n        resourceClasses: [AsyncLockTicket, 'release'] \n    }\n);\n```\n\n### Creating client\n\nAsyncRpcClient requires socket.io client instance and a list of methods to be exposed.\n\n`AsyncRpcClient.socketio(socketClient, methods, options)` method creates AsyncRpcClient instance and exposes methods to socket.io client instance: \n    - `socketClient` socket.io client instance \n    - `methods` is an array with method names to be exposed\n    - `options` is an object with options: \n        - `requestTimeout` is a timeout for request to be confirmed by the server in milliseconds, default is no timeout\n\n### Calling remote methods\n\n`AsyncRpcClient` exposes methods that were specified in the constructor and the first argument should be a `CancellationToken` instance or `null` regardless of whether the  server method is async or not.\n\n```js\nlet sum = await asyncRpcClient.add(null, 1, 2); // `ct` argument is null, wait for the result indefinitely\nsum = await asyncRpcClient.add(CT.timeout(100), 1, 2); // call will be cancelled after 100ms if the result is not received\nawait asyncRpcClient.wait(CT.manual(), 1000); // wait for 1 second\n```\n\n### Releasing remote resources\n\nRemote resources are released by calling `release()` method of the resource instance. If the resource is not released, it will be released automatically when the connection is closed.\n\n```js\nlet remoteResource = await asyncRpcClient.lock(null, 1); // acquire remote lock, returns AsyncRpcRemoteResource\nremoteResource.release(); // request for a release and return immediately\nawait remoteResource.waitRelease(CT.manual()); // wait for remote lock release\n```\n\n### Misc client methods and properties\n\n- `waitConnected(ct = null)` wait for the connection to be established\n- `waitDisconnected(ct = null)` wait for the connection to be closed\n- `connected` returns `true` if the connection is currently established\n- `connect()` establish connection\n- `disconnect()` close connection\n\n### Misc server methods and properties\n\n- `destroy()` stop accepting new connections\n\n### Events\n\n- `open` - emitted when the connection is established\n- `close` - emitted when the connection is closed\n\n### Client error markers\n\nUsed as markers for cancellation errors thrown by the client (`error.marker`);\n\n```js\nimport { AsyncRpcClientMarkers } from '@async-cancellables/async-simple-rpc';\n```\n\n- `AsyncRpcClientMarkers.RequestTimeout` - request timeout (if `requestTimeout` option is specified)\n- `AsyncRpcClientMarkers.ConnectionClosed` - connection closed during request or was closed before request was made\n\n## Authors\n\n-   **vuwuv** - _Initial work_ - [vuwuv](https://github.com/vuwuv)\n\n## License\n\n[MIT License] © vuwuv\n","readmeFilename":"README.md"}