Time has come for the last example of this book, once again using both AsyncIO and RxPY. This last example is an implementation of the publish/subscribe communication pattern on a TCP connection. Two applications will be implemented here: the publisher, implemented in a TCP server, and the subscriber, implemented in a TCP client.
The publisher emits either an observable of four numbers (1, 2, 3, 4), or an observable containing the "let's go" string, each time a remote observer subscribes to it. The observable being returned depends on a parameter provided by the subscriber. The publisher supports several clients connected at the same time, and routes the items to the corresponding client.
Both applications are implemented via Cyclotron. The boilerplate to set up the project is not detailed in this chapter, so that explanations of the...