@@ -67,15 +67,23 @@ public function __construct(
67
67
68
68
public function __invoke (array $ msg )
69
69
{
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 ;
71
80
72
81
$ header = json_decode ($ header , true );
73
82
$ content = json_decode ($ content , true );
74
83
75
84
$ this ->logger ->debug ('Received message ' , [
76
85
'processId ' => getmypid (),
77
- 'zmqId ' => htmlentities ($ zmqId , ENT_COMPAT , "UTF-8 " ),
78
- 'delim ' => $ delim ,
86
+ 'zmqIds ' => htmlentities (implode (", " , $ zmqIds ), ENT_COMPAT , "UTF-8 " ),
79
87
'hmac ' => $ hmac ,
80
88
'header ' => $ header ,
81
89
'parentHeader ' => $ parentHeader ,
@@ -84,13 +92,13 @@ public function __invoke(array $msg)
84
92
]);
85
93
86
94
if ('kernel_info_request ' === $ header ['msg_type ' ]) {
87
- $ this ->kernelInfoAction ->call ($ header , $ content , $ zmqId );
95
+ $ this ->kernelInfoAction ->call ($ header , $ content , $ zmqIds );
88
96
} elseif ('execute_request ' === $ header ['msg_type ' ]) {
89
- $ this ->executeAction ->call ($ header , $ content , $ zmqId );
97
+ $ this ->executeAction ->call ($ header , $ content , $ zmqIds );
90
98
} elseif ('history_request ' === $ header ['msg_type ' ]) {
91
- $ this ->historyAction ->call ($ header , $ content , $ zmqId );
99
+ $ this ->historyAction ->call ($ header , $ content , $ zmqIds );
92
100
} elseif ('shutdown_request ' === $ header ['msg_type ' ]) {
93
- $ this ->shutdownAction ->call ($ header , $ content , $ zmqId );
101
+ $ this ->shutdownAction ->call ($ header , $ content , $ zmqIds );
94
102
} elseif ('comm_open ' === $ header ['msg_type ' ]) {
95
103
// TODO: Research about what should be done.
96
104
} else {
0 commit comments