File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -302,16 +302,11 @@ impl Shell {
302
302
/// request from the frontend to deliver a message to a backend, often as
303
303
/// the request side of a request/response pair.
304
304
fn handle_comm_msg ( & self , header : JupyterHeader , msg : & CommWireMsg ) -> crate :: Result < ( ) > {
305
- // If there is a `jsonrpc` field, we treat the presence of `id` as a
306
- // request rather than a notification. If there is no such field, we
307
- // have a regular message from one of the regular Positron client comms.
308
- // In the future we should only support proper JSON-RPC messages, see
305
+ // The presence of an `id` field means this is a request, not a notification
309
306
// https://github.com/posit-dev/positron/issues/7448
310
- let request = msg. data . get ( "jsonrpc" ) . is_none ( ) || msg. data . get ( "id" ) . is_some ( ) ;
311
-
312
- let comm_msg = if request {
313
- // We don't consider the JSON-RPC `id` field which must exactly
314
- // match the one in the Jupyter header
307
+ let comm_msg = if msg. data . get ( "id" ) . is_some ( ) {
308
+ // Note that the JSON-RPC `id` field must exactly match the one in
309
+ // the Jupyter header
315
310
let request_id = header. msg_id . clone ( ) ;
316
311
317
312
// Store this message as a pending RPC request so that when the comm
Original file line number Diff line number Diff line change @@ -155,7 +155,8 @@ fn test_amalthea_comms() {
155
155
156
156
let comm_req_id = frontend. send_shell ( CommWireMsg {
157
157
comm_id : comm_id. to_string ( ) ,
158
- data : serde_json:: Value :: Null ,
158
+ // Include `id` field to signal this is a request
159
+ data : serde_json:: json!( { "id" : "foo" } ) ,
159
160
} ) ;
160
161
161
162
frontend. recv_iopub_busy ( ) ;
You can’t perform that action at this time.
0 commit comments