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 @@
# On disconnect the queue consumer is cancelled so that new
# messages are left in the queue
import concurrent.futures
import json
import uuid
import time
from twisted.internet import reactor, threads
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.web.wsgi import WSGIResource
from autobahn.exception import Disconnected
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.token_model import TokenModel
from api_rest import create_app
......@@ -68,16 +67,12 @@ class SubscriptionServerProtocol(WebSocketServerProtocol):
if valid:
try:
client_id = parsed.get('client_id')
client = self.apiClients.get(parsed.get('client_id'))
client = self.apiClients.get(client_id)
if client:
self.client = client
allow = True
except Exception:
allow = False
if allow:
# setup queue consumer
SubscriptionListener.createListener(self)
return allow
......@@ -92,6 +87,9 @@ class SubscriptionServerProtocol(WebSocketServerProtocol):
Try authentication
"""
allow = self.auth(request.headers)
if allow:
# setup queue consumer
SubscriptionListener.createListener(self)
def onMessage(self, payload, 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