private-chat-app-with-laravel-vuejs-pusher
private-chat-app-with-laravel-vuejs-pusher copied to clipboard
Error in SessionController Lecture 41
i am receiving an error when i try to broadcast a session to pusher. My chat box and session is working before i try to broadcast a SessionEvent to pusher and when i type in this line of code broadcast(new SessionEvent($modifiedSession,auth()->id())); the session still creates in the database but the chat box does not open until i click on all the registered users and refresh the page this still does not fix the problem as the event does not send to pusher..
I have followed this tutorial to the letter and have made sure that it exactly the same as what is shown in the videos but yet i am still getting an error
Could someone please help me as i have wasted almost 5 days on this issue this is my code /Session Event =====================================/
session = $session; $this->session_by = $session_by; $this->dontBroadcastToCurrentUser(); } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new Channel('Chat'); } } /*Session Controller =====================================*/ auth()->id(),'user2_id'=>$request->contact_id]); $modifiedSession = new SessionResource($session); broadcast(new SessionEvent($modifiedSession,auth()->id())); return new $modifiedSession; } } /*Errors ==================================*/ this is the error i am recieving app.js:285 POST http://liveloveapp.me/session/create 500 (Internal Server Error) dispatchXhrRequest @ app.js:285 xhrAdapter @ app.js:119 dispatchRequest @ app.js:724 Promise.then (async) request @ app.js:531 Axios.(anonymous function) @ app.js:551 wrap @ app.js:984 createSession @ app.js:1842 openChat @ app.js:1837 click @ app.js:46785 invoker @ app.js:49251 fn._withTask.fn._withTask @ app.js:49036 app.js:651 Uncaught (in promise) Error: Request failed with status code 500 at createError (app.js:651) at settle (app.js:814) at XMLHttpRequest.handleLoad (app.js:184)
i fixed this problem i needed to change the windows.Echo encryption in the boostrap.js file within resources/js to false
Why to false does it needs to be true?