I could not find any guide or managed to get any of the examples working. The only example I got to work was machinekit/src/machinetalk/tutorial/zeroconf/resolve.py but didn't understand what was going on - nor was it clear if I have to understand what's happening or not.
Attached are two simple examples I came up with - if there are better ways of doing it please let me know. Both examples use the packages python-zmq and python-zeroconf which are available on all major distributions and for python2 and python3. The reason I used zeroconf instead of the avahi/dbus approach of resolve.py is because it's a lot simpler - at least from my perspective.
mk-hello-world.py scans for all machinekit services and prints each one of them to the screen. Once no more services are discovered the process is terminated by pressing Ctrl+C.
I consider this the hello-world for Machinetalk because it is the first step to connecting to machinetalk. Because Machinetalk uses random ports one must first find a service's endpoint before we can connect to it..
The simple services (from a code effort to usefulness standpoint) are the publish/subscriber services. mk-hello-service.py subsribes to the status and error service. Each published service has a list of topics one can subscribe to (I could not find any documentation about the details). One must subscribe to a topic in order to trigger the initial full update message. An empty string can be used as the topic which serves as a wildcard for all topics - although in this case no initial full update is triggered, but you'll get all subsequent incremental updates.
It turns out to be important that the reverse lookups are setup correctly, otherwise there are significant delays in establishing a connection.