add support for binary JPEG (server)
This commit is contained in:
1 parent
8369de53ba
commit
fe830afdeb
10 files changed
+121
-13
No files matched your search
@@ -33,6 +33,7 @@ export default class WSClient extends EventEmitter implements NetworkClient {
|
||||
getIP(): string {
|
||||
return this.ip;
|
||||
}
|
||||
|
||||
send(msg: string): Promise<void> {
|
||||
return new Promise((res, rej) => {
|
||||
if (!this.isOpen()) res();
|
||||
@@ -47,6 +48,20 @@ export default class WSClient extends EventEmitter implements NetworkClient {
|
||||
});
|
||||
}
|
||||
|
||||
sendBinary(msg: Uint8Array): Promise<void> {
|
||||
return new Promise((res, rej) => {
|
||||
if (!this.isOpen()) res();
|
||||
|
||||
this.socket.send(msg, (err) => {
|
||||
if (err) {
|
||||
rej(err);
|
||||
return;
|
||||
}
|
||||
res();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
close(): void {
|
||||
if (this.isOpen()) {
|
||||
// While this seems counterintutive, do note that the WebSocket protocol
|
||||
|
||||
Reference in new issue
Block a user