Skip to Content
Hands-On Reactive Programming with Python
book

Hands-On Reactive Programming with Python

by Romain Picard
October 2018
Intermediate to advanced
420 pages
10h 26m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Python

Implementation of the publisher

The publisher is implemented as a Cyclotron component, being the entry point of the application. This component implements the three layers of remote stream multiplexing in fewer than 30 lines of code, thanks to the ReactiveX operators. This component uses only one driver, the TCP server implemented in the previous example. Here is the function implementing this component:

def rmux_server(sources):    tcp_listen = Observable.just(tcp_server.Listen(        host='127.0.0.1', port='8080'    ))    beat = (        sources.tcp_server.response        .flat_map(lambda connection: connection.observable            .map(lambda i: i.data.decode('utf-8'))            .let(unframe)            .map(lambda i: json.loads(i))            .flat_map(lambda subscription: create_observable[ subscription['name']]() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Programming with Design Patterns

Python Programming with Design Patterns

James W. Cooper

Publisher Resources

ISBN: 9781789138726Supplemental Content