Initial integration of behem0th.

This commit is contained in:
Christoph Heiss 2017-03-01 21:56:29 +01:00
parent 5188457be5
commit 7f067f40e9
4 changed files with 31 additions and 3 deletions

View file

@ -3,6 +3,8 @@ import Logging
import Config
import Utils
import behem0th
import socket
import time
import os
@ -331,6 +333,8 @@ except FileNotFoundError:
try:
sync_client = behem0th.Client(path=self.folder, verbose_log=True)
ws = Handler(config.server_address)
# setup has to be called before the connection is established
ws.setup({"subscribe" : Subscribe(), "hostname" : Hostname(),
@ -341,6 +345,9 @@ try:
"reboot" : Reboot()},
debug=config.debug)
ws.connect()
sync_client.connect(Utils.get_ip_from_url(config.server_address))
ws.run_forever()
except KeyboardInterrupt:
ws.close()
ws.close()
sync_client.close()