Skip to content

Commit ecd2822

Browse files
authored
Make the kernel_websocket_protocol flag reusable. (#1264)
1 parent e6be0fa commit ecd2822

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

jupyter_server/services/kernels/connection/base.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from jupyter_client.session import Session
66
from tornado.websocket import WebSocketHandler
7-
from traitlets import Float, Instance, default
7+
from traitlets import Float, Instance, Unicode, default
88
from traitlets.config import LoggingConfigurable
99

1010
try:
@@ -14,6 +14,8 @@
1414

1515
from jupyter_client.jsonutil import extract_dates
1616

17+
from jupyter_server.transutils import _i18n
18+
1719
from .abc import KernelWebsocketConnectionABC
1820

1921

@@ -110,6 +112,19 @@ def deserialize_msg_from_ws_v1(ws_msg):
110112
class BaseKernelWebsocketConnection(LoggingConfigurable):
111113
"""A configurable base class for connecting Kernel WebSockets to ZMQ sockets."""
112114

115+
kernel_ws_protocol = Unicode(
116+
None,
117+
allow_none=True,
118+
config=True,
119+
help=_i18n(
120+
"Preferred kernel message protocol over websocket to use (default: None). "
121+
"If an empty string is passed, select the legacy protocol. If None, "
122+
"the selected protocol will depend on what the front-end supports "
123+
"(usually the most recent protocol supported by the back-end and the "
124+
"front-end)."
125+
),
126+
)
127+
113128
@property
114129
def kernel_manager(self):
115130
"""The kernel manager."""

jupyter_server/services/kernels/connection/channels.py

-13
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,6 @@ class ZMQChannelsWebsocketConnection(BaseKernelWebsocketConnection):
8585
),
8686
)
8787

88-
kernel_ws_protocol = Unicode(
89-
None,
90-
allow_none=True,
91-
config=True,
92-
help=_i18n(
93-
"Preferred kernel message protocol over websocket to use (default: None). "
94-
"If an empty string is passed, select the legacy protocol. If None, "
95-
"the selected protocol will depend on what the front-end supports "
96-
"(usually the most recent protocol supported by the back-end and the "
97-
"front-end)."
98-
),
99-
)
100-
10188
@property
10289
def write_message(self):
10390
"""Alias to the websocket handler's write_message method."""

0 commit comments

Comments
 (0)