Open developernaren opened 4 years ago
In the WAMP spec, the publish message is structured to have a JSON array argument list, and a separate JSON object argument. Thruway expects the 2nd argument to be the array list, and the 3rd one to be the object, which is analogous to how other implementations do it.
To put this another way, your first array needs to be indexed, and the second one needs to be associative. i.e.
$session->publish('client.1', [], ['name' => 'Naren']);
There are several things Thruway could do before making the publish call to make this more convenient, but only one of them is better than the status quo IMO:
I am trying to publish this array which will be consumer as an object
I get this error
I feel like somewhere the code is doing
json_encode
andjson_decode
and turning this into an object. dumping the variable$arguements
prints it twice once as an array and the second time as an objectAdding this condition fixes it but not sure it this has unintended consequences.
I guess the workaround would be to pass array of single json string.