<commit_before>.. _aiozmq-rpc:

:mod:`aiozmq.rpc` --- Remote Procedure Calls
============================================

.. module:: aiozmq.rpc
   :synopsis: RPC for ZeroMQ transports
.. currentmodule:: aiozmq.rpc


Intro
-----

While :ref:`low-level API <aiozmq-low-level>` provides core support for
:term:`ZeroMQ` transports an :term:`End User <enduser>` usually needs for
some high-level API.

Thus we have the :mod:`aiozmq.rpc` for Remote Procedure Calls.

The main goal of the module is to provide *easy-to-use interface* for
calling some method from remote process, which may be
started on other host.

:term:`ZeroMQ` itself gives handy sockets but says nothing about RPC.

In other hand this module provides human API but is not compatible with
others.

If you need to support some RPC protocol over ZeroMQ layer please feel
free to build your own implementation on top of :ref:`low level
primitives <aiozmq-low-level>`.

This module uses :term:`ZeroMQ` *DEALER*/*ROUTER* sockets and custom
communication protocol (which uses :term:`msgpack` by the way).


.. _aiozmq-rpc-client:

RPC Client
----------

The basic usage is::

   import asyncio
   from aiozmq import rpc

   @asyncio.coroutine
   def func():
       client = yield from rpc.open_client(connect='tcp://127.0.0.1:5555')

       val = yield from client.rpc.func1(arg1, arg2)

       client.close()<commit_msg>Rewording the doc<commit_after>.. _aiozmq-rpc:

:mod:`aiozmq.rpc` --- Remote Procedure Calls
============================================

.. module:: aiozmq.rpc
   :synopsis: RPC for ZeroMQ transports
.. currentmodule:: aiozmq.rpc


Intro
-----

While :ref:`low-level API <aiozmq-low-level>` provides core support for
:term:`ZeroMQ` transports an :term:`End User <enduser>` usually needs for
some high-level API.

Thus we have the :mod:`aiozmq.rpc` for Remote Procedure Calls.

The main goal of the module is to provide *easy-to-use interface* for
calling some method from remote process, which may be
started on other host.

:term:`ZeroMQ` itself gives handy sockets but says nothing about RPC.

In other hand this module provides human API but is not compatible with
other implementations.

If you need to support some RPC protocol over ZeroMQ layer please feel
free to build your own implementation on top of :ref:`low level
primitives <aiozmq-low-level>`.

This module uses :term:`ZeroMQ` *DEALER*/*ROUTER* sockets and custom
communication protocol (which uses :term:`msgpack` by the way).


.. _aiozmq-rpc-client:

RPC Client
----------

The basic usage is::

   import asyncio
   from aiozmq import rpc

   @asyncio.coroutine
   def func():
       client = yield from rpc.open_client(connect='tcp://127.0.0.1:5555')

       val = yield from client.rpc.func1(arg1, arg2)

       client.close()
{'fraction_non_alphanumeric': 0.1331414177761785, 'fraction_numerical': 0.009355883411299028, 'mean_word_length': 3.86013986013986, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7407596', 'n_tokens_mistral': 903, 'n_tokens_neox': 844, 'n_words': 326}