diff --git a/monitor.py b/monitor.py index 21f8879..33ca53f 100644 --- a/monitor.py +++ b/monitor.py @@ -1003,11 +1003,24 @@ if __name__ == '__main__': # Connect to HBlink reactor.connectTCP(HBLINK_IP, HBLINK_PORT, reportClientFactory()) + - # Create websocket server to push content to clients + # HBmonitor does not require the use of SSL as no "sensitive data" is sent to it but if you want to use SSL: + # create websocket server to push content to clients via SSL https:// + # the web server apache2 should be configured with a signed certificate for example Letsencrypt + # we need install pyOpenSSL required by twisted: pip3 install pyOpenSSL + # and add load ssl module in line number 43: from twisted.internet import reactor, task, ssl + # + # put certificate https://letsencrypt.org/ used in apache server + #certificate = ssl.DefaultOpenSSLContextFactory('/etc/letsencrypt/live/hbmon.dmrserver.org/privkey.pem', '/etc/letsencrypt/live/hbmon.dmrserver.org/cert.pem') + #dashboard_server = dashboardFactory('wss://*:9000') + #dashboard_server.protocol = dashboard + #reactor.listenSSL(9000, dashboard_server,certificate) + # Create websocket server to push content to clients via http:// non SSL dashboard_server = dashboardFactory('ws://*:9000') dashboard_server.protocol = dashboard reactor.listenTCP(9000, dashboard_server) + reactor.run()