summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-09-15 10:46:10 +0200
committerAleš Smodiš <aless@guru.si>2015-09-15 10:46:10 +0200
commit64073d4c7efb2f21f66d0fea5083c659a1b0a15e (patch)
tree45b778a32cf2e15ff8edd8ea23efc13176d98ca2
parenta49a44fc4b06f2675de3a4f7cbc9ac4e477f1c28 (diff)
Augmented the readme with apache directives for proxying websocket directives.
-rw-r--r--readme.md6
-rw-r--r--server/socket.py6
-rw-r--r--web/main.js2
3 files changed, 11 insertions, 3 deletions
diff --git a/readme.md b/readme.md
index f52a663..d575149 100644
--- a/readme.md
+++ b/readme.md
@@ -16,6 +16,12 @@ Settings:
- point webroot to codeq-web
- set up reverse proxy for /ws/ to the node server:
+ - using the command a2enmod enable apache modules: proxy, proxy_http, proxy_wstunnel, rewrite
+ - add to the apache configuration the following directives:
+ RewriteEngine on
+ RewriteCond %{REQUEST_URI} ^/ws/ [NC]
+ RewriteCond %{QUERY_STRING} transport=websocket [NC]
+ RewriteRule /(.*) ws://localhost:8083/$1 [P,L]
ProxyPass /ws/ http://localhost:8083/ws/
ProxyPassReverse /ws/ http://localhost:8083/ws/
- set _path_prefix in server.problems
diff --git a/server/socket.py b/server/socket.py
index c248056..b184d4b 100644
--- a/server/socket.py
+++ b/server/socket.py
@@ -20,8 +20,10 @@ _transactions_to_socket = {} # keyed by tid, used only when there is no sid ava
def processIncomingPacket(receiving_socket, packet):
print('Decocoding JSON: {}'.format(packet))
obj = json.loads(packet)
- if obj.get('type') == 'connect':
+ req_type = obj.get('type') # private (meta) requests have the 'type'
+ if req_type == 'connect':
return # TODO: first packet is 'connect', providing the list of connected sessions to the peer
+
tid = obj.get('tid') # transaction ID
if tid is None:
raise Exception('Transaction ID is missing from the request')
@@ -270,7 +272,7 @@ class Communication(SocketHandler):
lock.release()
for handler in handlers:
handler.destroy() # destroy them all, even the server socket
- # this is where everything is destroyed but us, so what follows is self-destruct
+ # this is where everything has been destroyed but us, so what follows is self-destruct
lock.acquire()
try:
self._destroying = True
diff --git a/web/main.js b/web/main.js
index d2b84af..7f1b2e4 100644
--- a/web/main.js
+++ b/web/main.js
@@ -195,7 +195,7 @@ server.on('connection', function (socket) {
};
socket.on('close', function (reason, description) { // description is optional
- logger.debug('GUI socket closed');
+ logger.debug('GUI socket closed: ' + reason);
if (session.sid !== null) {
if (sessions[session.sid] === session) delete sessions[session.sid];
sendDataToPython({'type': 'unregister', 'sid': session.sid});