R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is a socket library providing high-performance scalability protocols, implementing a cross-platform standard for messaging and communications. Serves as a concurrency framework for building distributed applications, utilising 'Aio' objects which automatically resolve upon completion of asynchronous operations.
Call nano_init
after package load to set global options
such as causing warnings to print immediately as they occur.
{nanonext} offers 2 equivalent interfaces: an object-oriented interface, and a functional interface.
The primary object in the object-oriented interface is the nano object.
Use nano
to create a nano object which encapsulates a Socket
and Dialer/Listener. Methods such as $send()
or $recv()
can
then be accessed directly from the object.
The primary object in the functional interface is the Socket. Use
socket
to create a socket, and optionally dial or listen at
an address. The socket is then passed as the first argument of subsequent
actions such as send()
or recv()
.
Guide to the implemented protocols for sockets: protocols
Guide to the supported transports for dialers and listeners: transports
Options that can be set using setopt()
: options
NNG presents a socket view of networking. The sockets are constructed using protocol-specific functions, as a given socket implements precisely one protocol.
Each socket can be used to send and receive messages (if the protocol supports it, and implements the appropriate protocol semantics). For example, sub sockets automatically filter incoming messages to discard those for topics that have not been subscribed.
NNG sockets are message oriented, so that messages are either delivered wholly, or not at all. Partial delivery is not possible. Furthermore, NNG does not provide any other delivery or ordering guarantees; messages may be dropped or reordered (some protocols, such as req may offer stronger guarantees by performing their own retry and validation schemes).
Each socket can have zero, one, or many endpoints, which are either listeners or dialers (a given socket may freely choose whether it uses listeners, dialers, or both). These endpoints provide access to underlying transports, such as TCP, etc.
Each endpoint is associated with a URL, which is a service address. For dialers, this will be the service address that will be contacted, whereas for listeners this is where the listener will accept new connections.
nanonext website: https://shikokuchuo.net/nanonext/ nanonext on CRAN: https://cran.r-project.org/package=nanonext
NNG website: https://nng.nanomsg.org/
Copyright (C) 2022 Hibiki AI Limited <info@hibiki-ai.com>
This file is a part of nanonext.
nanonext is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
nanonext is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with nanonext. If not, see <https://www.gnu.org/licenses/>.
nanonext links to the NNG library with the following licence:
The MIT License
Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> Copyright 2018 Capitar IT Group BV <info@capitar.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.