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 */
/* TODO: Send error here */
//JSONValue errorResponse;
//errorResponse["dd"] = 2;
//debugPrint("Response error");
}
catch(Exception e)
{

View File

@ -146,7 +146,11 @@ public final class HandlerResponse
/* TODO: Implement me */
/* 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

View File

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