mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-21 21:01:29 +01:00
[Refactoring] GramJs: Replace deprecated functions (#32)
This commit is contained in:
parent
71d56e2f51
commit
f8c369bef1
@ -128,16 +128,13 @@ class PromisedWebSockets {
|
||||
|
||||
receive() {
|
||||
this.client.onmessage = async (message) => {
|
||||
const release = await mutex.acquire();
|
||||
try {
|
||||
await mutex.runExclusive(async () => {
|
||||
const data = message.data instanceof ArrayBuffer
|
||||
? Buffer.from(message.data)
|
||||
: Buffer.from(await new Response(message.data).arrayBuffer());
|
||||
this.stream = Buffer.concat([this.stream, data]);
|
||||
this.resolveRead(true);
|
||||
} finally {
|
||||
release();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user