Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/torxed/slimws

WebSocket API engine.
https://github.com/torxed/slimws

http https json minimal not-secure server tiny vhost web websocket

Last synced: about 10 hours ago
JSON representation

WebSocket API engine.

Awesome Lists containing this project

README

        

# drawing
WebSocket framework writtein in Python.

Works standalone but is preferred as `@upgrader` for [slimHTTP](https://github.com/Torxed/slimHTTP).

* slimWS [documentation](https://slimws.readthedocs.io/en/latest)
* slimWS via slimHTTP's [discord](https://discord.gg/CMjZbwR) server

# Installation

### pypi

pip install slimWS

### Git it to a project

git submodule add -b master https://github.com/Torxed/slimWS.git

*(Or just `git clone https://github.com/Torxed/slimWS.git`)*

# Usage

Most examples will be found under the [documentation](https://slimws.readthedocs.io/en/latest), but here's a quick one.

```python
from slimWS import slimws

server = slimws.host(address='', port=4001)

@server.frame
def parse_frame(self, frame):
print('Got WebSocket frame:', frame.data)
yield {'status' : 'successful'}

while 1:
for event, *event_data in server.poll():
pass
```