Changed API

This commit is contained in:
Tristan B. Velloza Kildaire 2021-09-08 20:50:22 +02:00
parent b060b30c44
commit e5a0a280bc
4 changed files with 8 additions and 7 deletions

View File

@ -52,7 +52,7 @@ byte[] data = cast(byte[])"Hello";
DataMessage tristanEncoded = new DataMessage(tag, data);
/* Then send it */
manager.sendMessage(tristanEncoded);
socket.send(encodeForSend(tristanEncoded));
```
And let tristanable handle it! We even handle the message lengths and everything using another great project [bformat](http://deavmi.assigned.network/projects/bformat).

View File

@ -57,4 +57,11 @@ public final class DataMessage
{
return tag;
}
}
public static byte[] encodeForSend(DataMessage message)
{
import bmessage;
return encodeBformat(message.encode());
}

View File

@ -62,12 +62,6 @@ public final class Manager
return matchingQueue;
}
public void sendMessage(DataMessage message)
{
import bmessage;
sendMessage(socket, message);
}
/* TODO: Probably remove this or keep it */
public bool isValidTag(ulong tag)
{

BIN
tristanable-test-library Executable file

Binary file not shown.