Skip to main content

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.

Release files for userv.socket-server 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for userv.socket-server 0.3.2
File Size Uploaded
userv.socket_server-0.3.2.tar.gz 1.8 kB Details

Release files / userv.socket_server-0.3.2.tar.gz

Download URL userv.socket_server-0.3.2.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1485e63a745cf2fa52bcc6612f29d940ac29c2b9b7c597e77f4af6d629544cb0
BLAKE2b-256 checksum
How to use checksums
05a9614d0d9be57f99468085841ca2b21cea374cdc9d521f55740b76b7177d89
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.2 This release

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page