-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use WebSocket binary data (no base64 enc/dec) if available.
If typed arrays (arraybuffers) are available and the WebSocket implementation supports them, then send and receive direct binary frames and skip base64 encode/decode. Otherwise we just fallback to the current method of sending base64 encoded strings (with a couple of extra checks for mode in the send/receive path). The check for binaryType support in WebSocket is a collosal hack right now due to the fact that the 'binaryType' property doesn't exist on the WebSocket prototype. So we have to create a connection to a localhost port in order to test. A potentionally big performance boost could probably be achieved by re-using a larger typed array for storing the data instead of creating a typed array every time we receive a message.
- Loading branch information
Showing
1 changed file
with
86 additions
and
21 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