expose passthrough for WebSocketHandler.get_compression_options

adds `NotebookApp.websocket_compression_options` configurable,
with a default of None (no compression)
pull/2492/head
Min RK 9 years ago
parent c50b47af12
commit a49397bf98

@ -296,5 +296,4 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):
self.session = Session(config=self.config)
def get_compression_options(self):
# use deflate compress websocket
return {}
return self.settings.get('websocket_compression_options', None)

@ -93,7 +93,7 @@ from jupyter_client.kernelspec import KernelSpecManager, NoSuchKernel, NATIVE_KE
from jupyter_client.session import Session
from nbformat.sign import NotebookNotary
from traitlets import (
Dict, Unicode, Integer, List, Bool, Bytes, Instance,
Any, Dict, Unicode, Integer, List, Bool, Bytes, Instance,
TraitError, Type, Float, observe, default, validate
)
from ipython_genutils import py3compat
@ -740,7 +740,18 @@ class NotebookApp(JupyterApp):
tornado_settings = Dict(config=True,
help="Supply overrides for the tornado.web.Application that the "
"Jupyter notebook uses.")
websocket_compression_options = Any(None, config=True,
help="""
Set the tornado compression options for websocket connections.
This value will be returned from :meth:`WebSocketHandler.get_compression_options`.
None (default) will disable compression.
A dict (even an empty one) will enable compression.
See the tornado docs for WebSocketHandler.get_compression_options for details.
"""
)
terminado_settings = Dict(config=True,
help='Supply overrides for terminado. Currently only supports "shell_command".')
@ -1107,6 +1118,7 @@ class NotebookApp(JupyterApp):
def init_webapp(self):
"""initialize tornado webapp and httpserver"""
self.tornado_settings['allow_origin'] = self.allow_origin
self.tornado_settings['websocket_compression_options'] = self.websocket_compression_options
if self.allow_origin_pat:
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat)
self.tornado_settings['allow_credentials'] = self.allow_credentials

Loading…
Cancel
Save