WIP: Handler abstraction

This commit is contained in:
Tristan B. Kildaire 2020-04-28 18:19:27 +02:00
parent ed1f995b3c
commit 49e4317867
3 changed files with 12 additions and 5 deletions

View File

@ -195,6 +195,9 @@ public final class BesterConnection : Thread
/* In the case of an error with the message handler, send an error to the client/server */ /* In the case of an error with the message handler, send an error to the client/server */
/* TODO: Send error here */ /* TODO: Send error here */
//JSONValue errorResponse;
//errorResponse["dd"] = 2;
//debugPrint("Response error");
} }
catch(Exception e) catch(Exception e)
{ {

View File

@ -146,7 +146,11 @@ public final class HandlerResponse
/* TODO: Implement me */ /* TODO: Implement me */
/* TODO: Construct a payload for the receiving clients */ /* TODO: Construct a payload for the receiving clients */
JSONValue clientPayload = parseJSON("\"HELLO\""); JSONValue clientPayload;
JSONValue headerBlock;
//headerBlock["handlerName"] =
clientPayload["header"] = 2;
/** /**
* Loop through each BesterConnection in connectionList and * Loop through each BesterConnection in connectionList and

View File

@ -20,10 +20,10 @@ def basicTest():
print(receivedData) print(receivedData)
# Now we can do it again (without authentication) # Now we can do it again (without authentication)
bys=json.dumps({"header":{},"payload":{"data":"POES","type":"type1"}}) #bys=json.dumps({"header":{},"payload":{"data":"POES","type":"type1"}})
print(len(bys), bys) #print(len(bys), bys)
d.send(len(bys).to_bytes(4, "little")) #d.send(len(bys).to_bytes(4, "little"))
d.send(bys.encode()) #d.send(bys.encode())
while True: pass while True: pass
d.close() d.close()