Async server for userv
Project description
The catch
Most simplistic socket server for micropython
Webserver
first we need to add routes to a router. This is described in userv.core although serving static files is described below.
Example:
from userv.routing import Router from userv.socket_server import run_server router = Router() # we add some routes run_server(router)
this way the server starts and runs forever. Because sometimes you want to start a standby mode there is way to kill the run task by given a callback which controls the loop. We call it the timeout callback for now. Basicly the server runs as long as the function returns True.
Example:
def we_never_timeout(): return True run_server(router, timeout_callback=we_never_timeout)
This is only a realy simple and silly example, but be aware to not do heavy lifting in this function, because it will hinder your server to react normal.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file userv.socket_server-0.3.2.tar.gz
.
File metadata
- Download URL: userv.socket_server-0.3.2.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1485e63a745cf2fa52bcc6612f29d940ac29c2b9b7c597e77f4af6d629544cb0 |
|
MD5 | ed26c20d148e63e326ece23e902f1a52 |
|
BLAKE2b-256 | 05a9614d0d9be57f99468085841ca2b21cea374cdc9d521f55740b76b7177d89 |