Fixed so multiple webserver interfaces don't kill the websocket client connection. Cleaned up some comments in settings.py.
This commit is contained in:
parent
ffa90e1a03
commit
19d6d4ff9e
2 changed files with 7 additions and 3 deletions
|
|
@ -247,6 +247,7 @@ if WEBSERVER_ENABLED:
|
||||||
|
|
||||||
# Start a reverse proxy to relay data to the Server-side webserver
|
# Start a reverse proxy to relay data to the Server-side webserver
|
||||||
|
|
||||||
|
websocket_started = False
|
||||||
for interface in WEBSERVER_INTERFACES:
|
for interface in WEBSERVER_INTERFACES:
|
||||||
ifacestr = ""
|
ifacestr = ""
|
||||||
if interface not in ('0.0.0.0', '::') or len(WEBSERVER_INTERFACES) > 1:
|
if interface not in ('0.0.0.0', '::') or len(WEBSERVER_INTERFACES) > 1:
|
||||||
|
|
@ -264,8 +265,9 @@ if WEBSERVER_ENABLED:
|
||||||
web_root.putChild("webclientdata", webclient)
|
web_root.putChild("webclientdata", webclient)
|
||||||
webclientstr = "\n + client (ajax only)"
|
webclientstr = "\n + client (ajax only)"
|
||||||
|
|
||||||
if WEBSOCKET_CLIENT_ENABLED:
|
if WEBSOCKET_CLIENT_ENABLED and not websocket_started:
|
||||||
# start websocket client port for the webclient
|
# start websocket client port for the webclient
|
||||||
|
# we only support one websocket client
|
||||||
from src.server.portal import websocket_client
|
from src.server.portal import websocket_client
|
||||||
from src.utils.txws import WebSocketFactory
|
from src.utils.txws import WebSocketFactory
|
||||||
|
|
||||||
|
|
@ -281,7 +283,7 @@ if WEBSERVER_ENABLED:
|
||||||
websocket_service = internet.TCPServer(port, WebSocketFactory(factory), interface=interface)
|
websocket_service = internet.TCPServer(port, WebSocketFactory(factory), interface=interface)
|
||||||
websocket_service.setName('EvenniaWebSocket%s' % pstring)
|
websocket_service.setName('EvenniaWebSocket%s' % pstring)
|
||||||
PORTAL.services.addService(websocket_service)
|
PORTAL.services.addService(websocket_service)
|
||||||
|
websocket_started = True
|
||||||
webclientstr = webclientstr[:-11] + "(%s:%s)" % (WEBSOCKET_CLIENT_URL, port)
|
webclientstr = webclientstr[:-11] + "(%s:%s)" % (WEBSOCKET_CLIENT_URL, port)
|
||||||
|
|
||||||
web_root = server.Site(web_root, logPath=settings.HTTP_LOG_FILE)
|
web_root = server.Site(web_root, logPath=settings.HTTP_LOG_FILE)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,9 @@ SSL_ENABLED = False
|
||||||
SSL_PORTS = [4001]
|
SSL_PORTS = [4001]
|
||||||
# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
|
# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
|
||||||
SSL_INTERFACES = ['0.0.0.0']
|
SSL_INTERFACES = ['0.0.0.0']
|
||||||
# Activate Websocket support
|
# Activate custom websocket support. This is unrelated to the websocket client!
|
||||||
|
# This is intended to be used by optional third-party connections/applications
|
||||||
|
# or clients.
|
||||||
WEBSOCKET_ENABLED = False
|
WEBSOCKET_ENABLED = False
|
||||||
# Ports to use for Websockets
|
# Ports to use for Websockets
|
||||||
WEBSOCKET_PORTS = [8021]
|
WEBSOCKET_PORTS = [8021]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue