Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 770 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 770 Bytes

There are three main components to the multi sensory processing framework named farmi.

There are publishers, which publish data; there are subscribers which subscribe to data and there is a directory service where publishers register themselves so that subscribers can find them.

Below a minimal example is shown:

directory_service.py (or just run farmi-server)

from farmi import DirectoryService
ds = DirectoryService()
ds.listen()

receiver.py

from farmi import Subscriber

def fn(topic, time_, msg):
    print(topic, time_, msg)

s = Subscriber('some_topic', fn)
s.listen()

sender.py

import time
from farmi import Publisher
pub = Publisher('some_topic')
time.sleep(1)

for i in range(10):
    pub.send((i, "hello!"))

pub.close()