(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env python3 | |
| import sys | |
| import socket | |
| import select | |
| def command(name, args=None): | |
| return {'name': name, 'args': args} | |
| def readcmd(): |
| import sys | |
| import gevent | |
| from gevent.monkey import patch_all; patch_all() | |
| from gevent import server, event, socket | |
| from multiprocessing import Process, current_process, cpu_count | |
| """ | |
| Simple multiprocess StreamServer that proxies messages between clients. | |
| Avoids using a multiprocessing.Event since it blocks on a semaphore. |