Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental zlib-stream support part 1: Gateway JSON
The built-in zlib module is pretty bad at this. inflateSync() doesn't allow you to pass a custom context. The context-based stream from createInflate() is subject to race conditions, since another packet from the gateway WebSocket could enter the chunk queue before the flush() callback is called, causing the JSON parser to attempt to parse multiple JSON packets in one string. C'mon Node. Even PHP has a better API for this[1]. Things to work on: - See if we can cut down on CPU usage - Avoid an excessively large packet buffer in memory if the CPU can't keep up - zlib-stream for ETF support (is this even beneficial?) - console.log()s are everywhere [1]: http://php.net/manual/en/function.inflate-add.php
- Loading branch information
1 parent
1d8271a
commit 49c0654
Showing
2 changed files
with
166 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters