SDP: Subscription Data Protocol
import asyncio
import websockets
from rethinkdb import r
from subsdata.sdp import sdp, method, sub, get_connection, is_logged, has_role
@method
@is_logged
async def add(user, a, b):
return a + b
@method
@has_role('admin')
async def create(user):
connection = await get_connection()
await r.table('test').insert({'x': 0}).run(connection)
@method
async def increment(user, id, value):
connection = await get_connection()
await r.table('test').get(id).update({"x": r.row["x"]+value}).run(connection)
@sub
def x_less_than(user, max):
return r.table('test').filter(lambda row: (row['x'] < max))
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(websockets.serve(sdp, '0.0.0.0', 8888))
print("Real time server started at port 8888")
loop.run_forever()
loop.close()
#example of a docker-compose.yml
version: '3'
services:
ws:
build: .
stdin_open: true
tty: true
ports:
- "8888:8888"
volumes:
- ./:/usr/src/app
environment:
- RT=rdb
- DEBUG=1
- SECRET=secret
command: python -m watchgod app.main
rdb:
image: rethinkdb
ports:
- "8080:8080"
- "28015:28015"
volumes:
- './data:/data'
Metadata
Release files for subsdata 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| subsdata-0.1.2.tar.gz | 3.7 kB | Without provenance | Details for subsdata-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| subsdata-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for subsdata-0.1.2-py3-none-any.whl |
Total release size: 8.5 kB
Release files / subsdata-0.1.2.tar.gz
| Download URL | subsdata-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
967aeaa0efd56f973932490a9f18593d0431d17809c879c20d1337cb7d9dd589
|
|
BLAKE2b-256 checksum How to use checksums |
6ace7abb1a0c084c143fbb52f082a705fe9e1a450d10e175d44873dd98bb9977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
|
Release files / subsdata-0.1.2-py3-none-any.whl
| Download URL | subsdata-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13824c9a8ebd5e75dcb43da940bfd7519828ac72d539f0a78f5c388b3e25c2c6
|
|
BLAKE2b-256 checksum How to use checksums |
e2f2b650176f4c518812b598f56c0a8f61bc895195e315805f6babe2673f4cae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
|
Security for subsdata 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.