Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An example to send and receive a bundle #62

Open
sergeLabo opened this issue Aug 11, 2021 · 1 comment
Open

An example to send and receive a bundle #62

sergeLabo opened this issue Aug 11, 2021 · 1 comment

Comments

@sergeLabo
Copy link

It would be useful to have an example about sending/sharing a bundle with a client.
I am currently working on how to use a bundle so I can send a list of list, latest being coordinate.

Here is my current progress :

Client:

points = [[1, 2, 3], [4, 5, 6]]

bundle = []

for i, msg in `enumerate(points):
    tag = ('/' + str(i)).encode('utf-8')
    bundle.append([tag, msg])

client.send_bundle(bundle)

Server:

def on_tag(*args):
    print(args)

for i in range(10):
    tag = ('/' + str(i)).encode('utf-8')
    server.bind(tag, on_tag, get_adress=True)

Is it good so far ?
Thanks you for your feedback.

@tshirtman
Copy link
Member

Really sorry for not answering before.
A bundle is a succession of messages, it's up to you to decide if you want to call the same endpoint multiple times with a different list (and maybe a list index to indicate which list it is), or a different end point for each list in the list of list.
Here your example would send to a different endpoint, which looks ok to me, but it's just one ways to use bundles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants