()
| 10 | ssl_context.load_verify_locations(localhost_pem) |
| 11 | |
| 12 | def hello(): |
| 13 | uri = "wss://localhost:8765" |
| 14 | with connect(uri, ssl=ssl_context) as websocket: |
| 15 | name = input("What's your name? ") |
| 16 | |
| 17 | websocket.send(name) |
| 18 | print(f">>> {name}") |
| 19 | |
| 20 | greeting = websocket.recv() |
| 21 | print(f"<<< {greeting}") |
| 22 | |
| 23 | if __name__ == "__main__": |
| 24 | hello() |