https://github.com/otl/jps
json pub sub
https://github.com/otl/jps
Last synced: about 2 months ago
JSON representation
json pub sub
- Host: GitHub
- URL: https://github.com/otl/jps
- Owner: OTL
- License: apache-2.0
- Created: 2016-01-26T13:27:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-17T14:58:13.000Z (almost 9 years ago)
- Last Synced: 2025-04-09T21:52:18.953Z (about 2 months ago)
- Language: Python
- Size: 91.8 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jps
=============jps is simple pub/sub system for python(v2.7 is supported now).
It is very easy to install and it is easy to understand if you have experience of ROS(Robot Operating System).see http://jps.readthedocs.org/
[](https://travis-ci.org/OTL/jps)
Install
------------------```bash
$ sudo pip install jps
```If it fails, try below.
```bash
sudo apt-get install python2.7-dev
```Publisher
---------------
`publisher.py````python
import jps
import timepub = jps.Publisher('/hoge1')
i = 0
while True:
pub.publish('hello! jps{0}'.format(i))
i += 1
time.sleep(0.5)
```Subscriber
----------------------
`subscriber.py````python
import jps
for msg in jps.Subscriber('/hoge1'):
print msg
```How to Run
---------------
You need three consoles.```bash
$ jps_master
``````bash
$ python publisher.py
``````bash
$ python subscriber.py
```