@@ -67,15 +67,23 @@ public function __construct(
6767
6868 public function __invoke (array $ msg )
6969 {
70- list ($ zmqId , $ delim , $ hmac , $ header , $ parentHeader , $ metadata , $ content ) = $ msg ;
70+ // Read ZMQ IDs until we reach the delimiter
71+ $ zmqIds = array ();
72+ while (!empty ($ msg )) {
73+ $ item = array_shift ($ msg );
74+ if ($ item === '<IDS|MSG> ' ) break ;
75+ else array_push ($ zmqIds , $ item );
76+ }
77+
78+ // Read the remaining items
79+ list ($ hmac , $ header , $ parentHeader , $ metadata , $ content ) = $ msg ;
7180
7281 $ header = json_decode ($ header , true );
7382 $ content = json_decode ($ content , true );
7483
7584 $ this ->logger ->debug ('Received message ' , [
7685 'processId ' => getmypid (),
77- 'zmqId ' => htmlentities ($ zmqId , ENT_COMPAT , "UTF-8 " ),
78- 'delim ' => $ delim ,
86+ 'zmqIds ' => htmlentities (implode (", " , $ zmqIds ), ENT_COMPAT , "UTF-8 " ),
7987 'hmac ' => $ hmac ,
8088 'header ' => $ header ,
8189 'parentHeader ' => $ parentHeader ,
@@ -84,13 +92,13 @@ public function __invoke(array $msg)
8492 ]);
8593
8694 if ('kernel_info_request ' === $ header ['msg_type ' ]) {
87- $ this ->kernelInfoAction ->call ($ header , $ content , $ zmqId );
95+ $ this ->kernelInfoAction ->call ($ header , $ content , $ zmqIds );
8896 } elseif ('execute_request ' === $ header ['msg_type ' ]) {
89- $ this ->executeAction ->call ($ header , $ content , $ zmqId );
97+ $ this ->executeAction ->call ($ header , $ content , $ zmqIds );
9098 } elseif ('history_request ' === $ header ['msg_type ' ]) {
91- $ this ->historyAction ->call ($ header , $ content , $ zmqId );
99+ $ this ->historyAction ->call ($ header , $ content , $ zmqIds );
92100 } elseif ('shutdown_request ' === $ header ['msg_type ' ]) {
93- $ this ->shutdownAction ->call ($ header , $ content , $ zmqId );
101+ $ this ->shutdownAction ->call ($ header , $ content , $ zmqIds );
94102 } elseif ('comm_open ' === $ header ['msg_type ' ]) {
95103 // TODO: Research about what should be done.
96104 } else {
0 commit comments