Access Chrome's internal gzip routine from Javascript

google-chrome, google-chrome-extension, gzip, javascript, websocket

Solution

Based on this answer to a Stack Overflow question, manually applying gzip to a WebSocket is completely unnecessary. As of version 19, Chrome will apparently compress WebSocket traffic automatically when the server supports it.

Problem

All modern browsers include gzip routines for exchanging compressed data with servers. Can anyone point me in the right direction for writing a Chrome extension that would allow Javascript to leverage this routine? I would like to compress some data in Javascript before sending it to the server over a WebSocket, and Chrome's built in deflate routine would certainly be faster than anything I could write in Javascript.

Original source