add some debugging things
This commit is contained in:
parent
e13b10fedf
commit
df6aee135c
3 changed files with 9 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
<script>
|
||||
let theFunniestStringEver = '';
|
||||
for (let i = 0; i < 1000000; i++) {
|
||||
for (let i = 0; i < 100000; i++) {
|
||||
theFunniestStringEver += 'h';
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ const parseWebsocketFrame = (data) => {
|
|||
|
||||
const frame = new WebsocketFrame();
|
||||
|
||||
console.log(firstByte.toString(2));
|
||||
|
||||
// 1 byte - first byte
|
||||
frame.FIN = (firstByte >> 7); // >> 7 - Get most significant bit (FIN)
|
||||
frame.RSVx = (firstByte & 0x70) >> 4; // 0x70[0b01110000] - Get the 3 bits after the most significant bit (RSVx)
|
||||
|
|
|
@ -22,8 +22,12 @@ class Socket extends EventEmitter {
|
|||
console.log(packet);
|
||||
|
||||
if (this._buffering && packet.FIN === 1) {
|
||||
try {
|
||||
this.emit('binary', Buffer.concat([this._buffering, packet.PayloadData]));
|
||||
this._buffering = undefined;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet.FIN === 0) {
|
||||
|
|
Loading…
Reference in a new issue