nahid/talk-example

POST http://localhost:8000/ajax/message/send 500 (Internal Server Error)

moritzwelsch opened this issue ยท 20 comments

I implemented your example in my Project, but now i cant send any messages.

jquery.js:8625 POST http://localhost:8000/ajax/message/send 500 (Internal Server Error)
send @ jquery.js:8625
ajax @ jquery.js:8161
(anonymous) @ talk.js:16
dispatch @ jquery.js:4430
r.handle @ jquery.js:4116

I have the same error when I send a message.

nahid commented

please share your code with me.

I had the same issue. I found that the auth::user() wasn't being set (I'm using Laravel 5.4).
What sorted it out for me was adding the following to the constructor of my controller:

$this->middleware(function ($request, $next) { Talk::setAuthUserId(Auth::user()->id); return $next($request); });

Hope that helps!

@kingsleyzissou its works!!

Thanks It works fine!
It also solved trying to get property on non object error for me..
Thank you soo much!!

@kingsleyzissou where i need to add this code ?

@marslan2037 you place it inside the constructor and delete the line

Talk::setAuthUserId(Auth::user()->id);

So your constructor should look like this:

public function __construct()
{
    $this->middleware('auth');

    View::composer('partials.peoplelist', function($view) {
        $threads = Talk::threads();
        $view->with(compact('threads'));
    });

    $this->middleware(function ($request, $next) {
        Talk::setAuthUserId(Auth::user()->id);
        return $next($request);
    });
}

i have same error

500 interval server error

@kingsleyzissou this is what in preview tab
No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]

@marslan2037 that's a different issue, it sounds like you need to setup redis on your computer and update the .env file with the correct information

what is redis ?

i update everything with pusher info

in env file and in talk.php also

preview tab shows this error, console shows 500 interval server error with message/send route

@kingsleyzissou i am using talk example, i did not add anything new in it, just did one change that have mention but same error, with and without that change

@marslan2037 this issue is closed, the issue you're having is unrelated.

[tcp://127.0.0.1:6379] -> port 6739 is used for redis
You can go here for more info https://redis.io/

If you get redis setup on your machine it should resolve the issue.

@kingsleyzissou ok, but i did not install anything new in it, if package did not have it then i have it, let me reclone it and try again

@kingsleyzissou anyway thanks for your help

i am same problem here........plz help me