socketify.py/README.md

35 wiersze
996 B
Markdown
Czysty Zwykły widok Historia

2022-05-24 19:29:51 +00:00
# uWebSockets.py
2022-05-24 19:37:16 +00:00
Fast WebSocket and Http/Https server using CFFI with C API from [uNetworking/uWebSockets](https://github.com/uNetworking/uWebSockets)
> This project will adapt the full capi from uNetworking/uWebSockets but for now it's just this.
### Overly simple hello world app
```python
2022-05-25 14:01:56 +00:00
from "uws" import App
2022-05-24 19:37:16 +00:00
2022-05-25 14:01:56 +00:00
app = App()
2022-05-24 19:37:16 +00:00
app.get("/", lambda res, req: res.end("Hello World uWS from Python!"))
2022-05-25 14:01:56 +00:00
app.listen(3000, lambda socket, config: print("Listening on port http://localhost:%d now\n" % config.port))
2022-05-24 19:37:16 +00:00
app.run()
```
### pip (working progress)
```bash
pip install git+https://github.com/cirospaciari/uWebSockets.py.git
```
### Run
```bash
pypy3 ./hello_world.py
```
2022-05-25 14:01:56 +00:00
### SSL version sample
``` python
from "uws" import App, AppOptions
app = App(AppOptions(key_file_name="./misc/key.pem", cert_file_name="./misc/cert.pem", passphrase="1234"))
app.get("/", plaintext)
app.listen(3000, lambda socket, config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()
```