benbjurstrom / livewire-mercure-demo

A demo Laravel app showcasing Mercure with Livewire
21 stars 2 forks source link

Installation problems #3

Open robindrost opened 11 months ago

robindrost commented 11 months ago

Hello,

When running the installation steps from the readme Sail returns an error that its missing Octane; ERROR There are no commands defined in the "octane" namespace.

This can be fixed by installing Octane with FrankenPHP.

After following the steps form the installation everything seems to work fine, including sending messages. However the messages are never shown in the frontend.

The following errors returns inside the console: [Error] Failed to load resource: A server with the specified hostname could not be found. (mercure, line 0) http://mercure/.well-known/mercure?topic=public.newMessage

I did not change anything else beside the base installation and installing octane.

hen3b182 commented 11 months ago

The address should go to something like: http://localhost:8888/.well-known/mercure?topic=public.newMessage and http://localhost:8888/.well-known/mercure?topic=private.1.newMessage

it's located in your env file: MERCURE_URL=http://localhost:8888/.well-known/mercure

robindrost commented 11 months ago

@hen3b182 Yes that should be the case. The problem is it is changed to http://mercure/ somewhere. I even tried hardcoding the localhost:8888 inside de data-mercure-url property but it keeps changing.

benbjurstrom commented 11 months ago

Are you sending messages using sail so they are dispatched from inside the laravel container ./vendor/bin/sail artisan message:send?

As for where the mercure hostname is coming from, I'm setting https://github.com/benbjurstrom/livewire-mercure-demo/blob/ed728980cff89c6d6218009e1a656184669f12a7/docker-compose.yml#L20 in the docker-compose.yml file. This overrides anything in your .env when running inside the container. Which is what you want if you're sending messages from inside the container using sail.

robindrost commented 11 months ago

@benbjurstrom Yes, I do run the command sail artisan message:send. But I keep getting errors in the frontend that it can not resolve the mercure url.