codypiersall / pynng

Python bindings for Nanomsg Next Generation.
https://pynng.readthedocs.io
MIT License
260 stars 58 forks source link

Non-nng client communicating with nng server? #91

Open chebee7i opened 2 years ago

chebee7i commented 2 years ago

I have a server running with trio and pynng. It would normally be using Rep0 and expecting to communicate with Req0.

However, some of my clients are unable to run pynng. I am wondering if it is possible (without a lot of extra work) for them to send the necessary info over to the server and get a response.

I'd guess that this is not possible. Do you have any other suggestions for how to achieve this sort of communication? Some of the clients are, unfortunately, still in Python 2 for a bit longer.

chebee7i commented 2 years ago

This seems relevant: https://stackoverflow.com/questions/17176871/can-zeromq-be-used-to-accept-traditional-socket-requests

codypiersall commented 2 years ago

Check out https://github.com/tonysimpson/nanomsg-python —-the API is different and it uses the legacy nanomsg library, but I believe it does still work with Python 2.7.

If you're feeling rather bold and ambitious, a pure-Python solution is possible; I outlined a hacky version in an answer on Stack Overflow. To do it right would require quite a bit of work in pure Python, but sometimes hacks are good enough.

If you can get nanomsg-python to work though that's what I would go with.