nahid / talk-example

This project is demo for Laravel-Talk package and its also Docker ready
http://github.com/nahid/talk
131 stars 77 forks source link

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

Closed moritzwelsch closed 7 years ago

moritzwelsch commented 7 years ago

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

ed-i-arellano commented 7 years ago

I have the same error when I send a message.

nahid commented 7 years ago

please share your code with me.

kingsleyzissou commented 7 years ago

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!

ElBetito commented 7 years ago

@kingsleyzissou its works!!

jbhoomi89 commented 7 years ago

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

marslan2037 commented 6 years ago

@kingsleyzissou where i need to add this code ?

kingsleyzissou commented 6 years ago

@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);
    });
}
marslan2037 commented 6 years ago

i have same error

marslan2037 commented 6 years ago

500 interval server error

marslan2037 commented 6 years ago

@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]

kingsleyzissou commented 6 years ago

@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

marslan2037 commented 6 years ago

what is redis ?

marslan2037 commented 6 years ago

i update everything with pusher info

marslan2037 commented 6 years ago

in env file and in talk.php also

marslan2037 commented 6 years ago

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

marslan2037 commented 6 years ago

@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

kingsleyzissou commented 6 years ago

@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.

marslan2037 commented 6 years ago

@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

marslan2037 commented 6 years ago

@kingsleyzissou anyway thanks for your help

alamintpi commented 4 years ago

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