diff --git a/README.md b/README.md index 2bebe2a..b8ae3a0 100644 --- a/README.md +++ b/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 ```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.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() ``` @@ -23,3 +23,13 @@ pip install git+https://github.com/cirospaciari/uWebSockets.py.git ```bash 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() +``` \ No newline at end of file diff --git a/main.py b/main.py index a20ba91..503f7bb 100644 --- a/main.py +++ b/main.py @@ -483,13 +483,6 @@ class AppListenOptions: self.host = host self.options = options -# typedef struct -# { -# int port; -# const char *host; -# int options; -# } uws_app_listen_config_t; - 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): if key_file_name != None and not isinstance(key_file_name, str): raise RuntimeError("key_file_name must be an String or None")