Verified Commit 86b61a8f authored by Dan Jones's avatar Dan Jones
Browse files

fix: remove unused imports

1 merge request!6Draft: Resolve "Add websockets"
Pipeline #262152 failed with stages
in 32 seconds
...@@ -18,17 +18,16 @@ ...@@ -18,17 +18,16 @@
# On disconnect the queue consumer is cancelled so that new # On disconnect the queue consumer is cancelled so that new
# messages are left in the queue # messages are left in the queue
import concurrent.futures
import json import json
import uuid import uuid
import time import time
from twisted.internet import reactor, threads from twisted.internet import reactor
from twisted.web.server import Site from twisted.web.server import Site
from twisted.web.resource import Resource from twisted.web.resource import Resource
from twisted.web.wsgi import WSGIResource from twisted.web.wsgi import WSGIResource
from autobahn.exception import Disconnected from autobahn.exception import Disconnected
from autobahn.twisted.resource import WebSocketResource from autobahn.twisted.resource import WebSocketResource
from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol, listenWS from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol
from models.client_model import ClientModel from models.client_model import ClientModel
from models.token_model import TokenModel from models.token_model import TokenModel
from api_rest import create_app from api_rest import create_app
...@@ -68,16 +67,12 @@ class SubscriptionServerProtocol(WebSocketServerProtocol): ...@@ -68,16 +67,12 @@ class SubscriptionServerProtocol(WebSocketServerProtocol):
if valid: if valid:
try: try:
client_id = parsed.get('client_id') client_id = parsed.get('client_id')
client = self.apiClients.get(parsed.get('client_id')) client = self.apiClients.get(client_id)
if client: if client:
self.client = client self.client = client
allow = True allow = True
except Exception: except Exception:
allow = False allow = False
if allow:
# setup queue consumer
SubscriptionListener.createListener(self)
return allow return allow
...@@ -92,6 +87,9 @@ class SubscriptionServerProtocol(WebSocketServerProtocol): ...@@ -92,6 +87,9 @@ class SubscriptionServerProtocol(WebSocketServerProtocol):
Try authentication Try authentication
""" """
allow = self.auth(request.headers) allow = self.auth(request.headers)
if allow:
# setup queue consumer
SubscriptionListener.createListener(self)
def onMessage(self, payload, isBinary): def onMessage(self, payload, isBinary):
if not isBinary: if not isBinary:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment