A super-lightweight IPC (Inter-Process Communication) protocol over TCP socket.
Project description
procbridge-python
ProcBridge is a super-lightweight IPC (Inter-Process Communication) protocol over TCP socket or Unix domain socket. It enables you to send and recieve JSON between processes easily. ProcBridge is much like a simplified version of HTTP protocol, but only transfer JSON values.
Please note that this repo is the Python implementation of ProcBridge protocol. You can find detailed introduction of ProcBridge protocol in the main repository: gongzhang/procbridge.
Installation
pip install procbridge==1.2.1
Example
Server Side:
import procbridge as pb
def delegate(method, args):
# define remote methods:
if method == 'echo':
return args
elif method == 'sum':
return sum(x for x in args)
elif method == 'err':
raise RuntimeError("an server error")
if __name__ == '__main__':
PORT = 8000
s = pb.Server('0.0.0.0', PORT, delegate)
s.start(daemon=False)
print("Server is on {}...".format(PORT))
Client Side:
import procbridge as pb
client = pb.Client('127.0.0.1', 8000)
# call remote methods:
client.request("echo", 123) # 123
client.request("echo", ['a', 'b', 'c']) # ['a', 'b', 'c']
client.request("sum", [1, 2, 3, 4]) # 10
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file procbridge-1.2.2.tar.gz.
File metadata
- Download URL: procbridge-1.2.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1b944d8cec978387d35cdeccd5fe10305c3cb34584b139dbcc40e150f8f035
|
|
| MD5 |
17aff0343898a5a8c6ad64113bb58309
|
|
| BLAKE2b-256 |
d335be0d61d9a5c4950b9ca44da1c8dc371bdfc2467b8e0a5af85f4be85d75b5
|
File details
Details for the file procbridge-1.2.2-py3-none-any.whl.
File metadata
- Download URL: procbridge-1.2.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e1675126c873fe163b055bca7e9802183ec7ce2711fafe42862b616653aa9be
|
|
| MD5 |
3dbda9c2d67f0284eb3da240af3f45cb
|
|
| BLAKE2b-256 |
07b67cf6935a1ab73e6f971f23c2ab13cd4e55eb77b8385e39491f9d3c990a6a
|