From fd1606bfa4a77b9df1c9f1e1a7f5a5d3e016c9c0 Mon Sep 17 00:00:00 2001 From: Nuno Sousa Date: Tue, 31 Oct 2017 00:26:37 +0000 Subject: [PATCH] Add timeout support for websocket connections --- samsungctl/remote_websocket.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samsungctl/remote_websocket.py b/samsungctl/remote_websocket.py index aa0247e..b1382ba 100644 --- a/samsungctl/remote_websocket.py +++ b/samsungctl/remote_websocket.py @@ -18,9 +18,8 @@ def __init__(self, config): URL_FORMAT = "ws://{}:{}/api/v2/channels/samsung.remote.control?name={}" """Make a new connection.""" - self.connection = websocket.WebSocket() - self.connection.connect(URL_FORMAT.format(config["host"], config["port"], - self._serialize_string(config["name"]))) + self.connection = websocket.create_connection(URL_FORMAT.format(config["host"], config["port"], + self._serialize_string(config["name"])), config["timeout"]) self._read_response()