title: Can I send gzip compressed data through tornado websocket in Python?
body: <p>I would like to send gzip compressed data from tornado server to javascript client. Here is my code.</p>
  
  <pre><code>buf = StringIO()
  gfile = gzip.GzipFile(mode='wb', fileobj=buf)
  try:
      gfile.write( "hello world" )
  finally:
      gfile.close()
  
  compressed_data = buf.getvalue()    
  self.write_message( compressed_data )
  </code></pre>
  
  <p>Server side doesn't provide error. But chrome produces an error "Could not decode a text frame as UTF8". </p>
  
  <p>Is there any workaround here?</p>