mercredi 1 août 2018

Laravel pusher broadcast 500 error: illegal offset type in isset or empty

Try to create random chat user with pusher on laravel. When I try to broadcast "Session" (It means connection) It return to me Failed to load resource: the server responded with a status of 500 (Internal Server Error) but error appear only for user who create the session. I try to explain how it works. I use Vue JS and Laravel. All starts when user click "Start chat" in some category. After that I check, is there already created by somebody chat request in this chat category in chatrequests table. If it is - this user create a "session" for them with data "id" "user1_id", 'user2_id" to sessions table and the chat window starts for them. (User that created request for chat wait for connection with every second request to sessions table to check is there already session created by another user). So, after all this things I have the data in sessions table and chatrequest row deleted from chatrequests table. The problem appear when I try to broadcast via Pusher this session with data: $session, $session_by: broadcast(new ConnectionEvent($modifiedConnection, $connection_by)); So, the data that I send to Pusher is:

'id' => $this->id,
'users' => [$this->user1_id, $this->user2_id]
'session_by => auth()->id() (because this function always called by the person who create the session)

After this I have the 500 with error:

message: "Illegal offset type in isset or empty", exception: "ErrorException",… "ErrorException" "/Users/jsk89/Sites/chat/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php" line 137. message "Illegal offset type in isset or empty"

One important thing: all the data successfully saved in the DB and the error appear only to user who create the session. Pusher keep silence.

PS: Pusher settings are correct because Presence event of connected users to the project broadcasting successfully.

I don't find my problem in the internet. Maybe somebody knows how to fix this. With hope...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire