title: Implementing permessage-deflate in WebSockets
body: <p>I hava a problem understanding and implementing a permessage-deflate extension in WebSockets.</p>
  
  <p>So far, I have added 'Sec-WebSocket-Extensions: permessage-deflate' inside handshake code. It seems to work all fine.</p>
  
  <p>However when I send a "TEST" message from the server (Node.js) to the Client (JS), it seems that the browser (both Chrome and Firefox) is not decompressing the data itself.</p>
  
  <p>How to properly implement data compression and decompression using permessage-deflate extension?</p>
  
  <p>Request Header:</p>
  
  <pre><code>GET ws://localhost/ HTTP/1.1
  Host: localhost
  Connection: Upgrade
  Pragma: no-cache
  Cache-Control: no-cache
  Upgrade: websocket
  Origin: null
  Sec-WebSocket-Version: 13
  User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36
  Accept-Encoding: gzip, deflate, sdch
  Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
  Sec-WebSocket-Key: X3RofjiYbzVR8zUPI5ZI6w==
  Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
  Sec-WebSocket-Protocol: Exodus_101
  </code></pre>
  
  <p>Response Header:</p>
  
  <pre><code>HTTP/1.1 101 Web Socket Protocol Handshake
  Upgrade: WebSocket
  Connection: Upgrade
  sec-websocket-accept: sFO1Id30BZe63QWcm894hnnb+Pg=
  Sec-WebSocket-Protocol: Exodus_101
  Sec-WebSocket-Extensions: permessage-deflate
  </code></pre>