Merge pull request #146 from mbohlool/closemethod
Add close method to websocket client
This commit is contained in:
commit
dc35eee071
@ -1,5 +1,6 @@
|
||||
# v1.0.1
|
||||
- Bugfix: blocking exec call should remove channel metadata #140
|
||||
- Add close method to websocket api of interactive exec #145
|
||||
|
||||
# v1.0.0b3
|
||||
- Bugfix: Missing websocket-client dependency #131
|
||||
|
||||
@ -92,3 +92,4 @@ print("Server date command returns: %s" % sdate)
|
||||
resp.write_stdin("whoami\n")
|
||||
user = resp.readline_stdout(timeout=3)
|
||||
print("Server user is: %s" % user)
|
||||
resp.close()
|
||||
|
||||
@ -191,6 +191,14 @@ class WSClient:
|
||||
while self.is_open():
|
||||
self.update(timeout=None)
|
||||
|
||||
def close(self, **kwargs):
|
||||
"""
|
||||
close websocket connection.
|
||||
"""
|
||||
self._connected = False
|
||||
if self.sock:
|
||||
self.sock.close(**kwargs)
|
||||
|
||||
|
||||
WSResponse = collections.namedtuple('WSResponse', ['data'])
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user