是的,它可以。Chrome 19+ 支持它。
"https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_compressed/server_advanced.py"
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.twisted.websocket import WebSocketServerFactory, \
listenWS
from autobahn.websocket.compress import *
def accept(offers):
for offer in offers:
return PerMessageDeflateOfferAccept(offer)
debug = True
factory = WebSocketServerFactory(u"ws://127.0.0.1:9000", debug=debug, debugCodePaths=debug)
factory.setProtocolOptions(perMessageCompressionAccept=accept)
listenWS(factory)
webdir = File(".")
web = Site(webdir)
reactor.listenTCP(8080, web)
reactor.run()
更多信息:如何在 Autobahn 示例中使用 PerMessageDeflateOffer。