require handshake

This commit is contained in:
Jakob Ketterl 2019-05-05 20:12:36 +02:00
parent 30f8244abf
commit 628731cba4
1 changed files with 21 additions and 12 deletions

View File

@ -60,10 +60,14 @@ class SpectrumForwarder(object):
class WebSocketMessageHandler(object):
def __init__(self):
self.handshake = None
self.forwarder = None
def handleTextMessage(self, conn, message):
if (message[:16] == "SERVER DE CLIENT"):
# maybe put some more info in there? nothing to store yet.
self.handshake = "completed"
config = {}
pm = PropertyManager.getSharedInstance()
@ -91,7 +95,12 @@ class WebSocketMessageHandler(object):
self.dsp = DspManager(self.forwarder)
else:
return
if not self.handshake:
print("not answering client request since handshake is not complete")
return
try:
message = json.loads(message)
if message["type"] == "dspcontrol":