Hi I am tring to build a real time chat application with websockets but whenever I try to go visit http://127.0.0.1:8000/laravel-websockets I get error 404 not found. I did all the steps like in the documentation so I don't understand what might be the issue: Followed all the steps here:
https://beyondco.de/docs/laravel-websockets/basic-usage/starting
websockets config
'apps' => [
[
'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'path' => env('PUSHER_APP_PATH'),
'capacity' => null,
'enable_client_messages' => false,
'enable_statistics' => true,
],
]
.env file
PUSHER_APP_ID=anyID
PUSHER_APP_KEY=anyKey
PUSHER_APP_SECRET=anySecret
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
First of all, as the documentation refers there is no line capacity second thing please make sure that you have followed the steps correctly, and make sure you set your APP_URL in the .env file properly. Try using Homestead or Valet as sometimes setting the URL to localhost or 127.0.0.1:8000 doesn't seem to work properly.
I have just did a quick test to check if something might go wrong but all seems to be working just as expected.
.env file:
APP_URL=http://homestead.laravel_websocket
...
PUSHER_APP_ID=moayadapp
PUSHER_APP_KEY=moayadkey
PUSHER_APP_SECRET=moayadsecret
PUSHER_APP_CLUSTER=mt1
websockets.php
'apps' => [
[
'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'path' => env('PUSHER_APP_PATH'),
// 'capacity' => null,
'enable_client_messages' => false,
'enable_statistics' => true,
],
],
I fixed this problem by running this command
php artisan config:clear
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Laravel is a free open source PHP framework that came out in 2011. Since then, it has been able to become the framework of choice for web developers. One of the main reasons for this is that Laravel makes it easier, faster, and safer to develop complex web applications than any other framework.
https://laravel.com/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.