kopia lustrzana https://github.com/cirospaciari/socketify.py
added SSL sample in README.md
rodzic
74f098bf50
commit
17c1b5b46b
16
README.md
16
README.md
|
@ -5,11 +5,11 @@ Fast WebSocket and Http/Https server using CFFI with C API from [uNetworking/uWe
|
||||||
|
|
||||||
### Overly simple hello world app
|
### Overly simple hello world app
|
||||||
```python
|
```python
|
||||||
from "uws" import UWSApp
|
from "uws" import App
|
||||||
|
|
||||||
app = UWSApp()
|
app = App()
|
||||||
app.get("/", lambda res, req: res.end("Hello World uWS from Python!"))
|
app.get("/", lambda res, req: res.end("Hello World uWS from Python!"))
|
||||||
app.listen(3000, lambda socket, config: print("Listening on port http://localhost:%s now\n" % str(config.port)))
|
app.listen(3000, lambda socket, config: print("Listening on port http://localhost:%d now\n" % config.port))
|
||||||
app.run()
|
app.run()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -23,3 +23,13 @@ pip install git+https://github.com/cirospaciari/uWebSockets.py.git
|
||||||
```bash
|
```bash
|
||||||
pypy3 ./hello_world.py
|
pypy3 ./hello_world.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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()
|
||||||
|
```
|
7
main.py
7
main.py
|
@ -483,13 +483,6 @@ class AppListenOptions:
|
||||||
self.host = host
|
self.host = host
|
||||||
self.options = options
|
self.options = options
|
||||||
|
|
||||||
# typedef struct
|
|
||||||
# {
|
|
||||||
# int port;
|
|
||||||
# const char *host;
|
|
||||||
# int options;
|
|
||||||
# } uws_app_listen_config_t;
|
|
||||||
|
|
||||||
class AppOptions:
|
class AppOptions:
|
||||||
def __init__(self, key_file_name=None, cert_file_name=None, passphrase=None, dh_params_file_name=None, ca_file_name=None, ssl_ciphers=None, ssl_prefer_low_memory_usage=0):
|
def __init__(self, key_file_name=None, cert_file_name=None, passphrase=None, dh_params_file_name=None, ca_file_name=None, ssl_ciphers=None, ssl_prefer_low_memory_usage=0):
|
||||||
if key_file_name != None and not isinstance(key_file_name, str): raise RuntimeError("key_file_name must be an String or None")
|
if key_file_name != None and not isinstance(key_file_name, str): raise RuntimeError("key_file_name must be an String or None")
|
||||||
|
|
Ładowanie…
Reference in New Issue