Soketi + Laravel
Hello, I'm struggling to connect Soketi and Laravel. I have it working in a Docker container locally, but porting everything to Railway gives me
Pusher error: cURL error 7: Failed to connect
when hitting an endpoint that attempts to connect.
I've set Soketi to port 6001, but I don't know if I'm using the correct HOST in my env. I've tried combinations of localhost, 0.0.0.0, soketi with both http and https schemes but no luck.28 Replies
Project ID:
9a5465ad-1619-425d-bdcd-bb8ad5b7b25a
9a5465ad-1619-425d-bdcd-bb8ad5b7b25a
read this please https://docs.railway.app/troubleshoot/fixing-common-errors
Yeah I've gone through that doc and the multiple similar questions where you've posted that answer and it works for people, but unfortunately listening on 0.0.0.0 gives me the same error
you also need to listen on $PORT
Yeah the same one as set in the Soketi env variables, or the port it randomly choosees. Same error
soketi is just websockets right?
Yep
then it's definitely supported
are running the soketi and laravel apps on separate railway services?
Yes
how are you calling the soketi service from your laravel service?
like what URL are you using?
I've tried 0.0.0.0, localhost, soketi
well you would need to use the url of the soketi service
or since that doesn't look like it takes a url, use the services domain as the host, and 443 as the port
After deploying the Soketi service it provides a public networking url that I tried using as the host, and also says using
soketi
should allow communication within railwaydoes your soketi railway service have a domain?
not a custom one
doesn't need to have a custom one
does it have a railway domain
host: <railway domain>
port: 443
scheme: https
this is the connection object used to connect soketi from laravel right?
Im not entirely sure tbh, it provides access to the Soketi server through something like
soketi-8sc4.up.railway.app
Yeah that's how laravel connectsokay what host and what port is socketi currently listening on?
This is all I get regarding host, I'm still unclear on how to set the host or tell what it is
please read the doc page I linked again
tl;dr socketi needs to listen on host 0.0.0.0 and the environment variable PORT
and as mentioned previously a couple of times, the host you use to connect to socketi from your laravel app is the domain railway gives you
let me know when you have done this please
I have re-read it. Im probably missing something but based on that page, I've set HOST=0.0.0.0 on Soketi. It redeploys and still says server is available at 127.0.0.1:6001
do you have a PORT service variable
yes, I set it to 6001 just to keep it static
you probably should read the socketi server docs to find out how to get it to listen on 0.0.0.0
I'll try that again, thanks. Figured others would have had the same issue when using Soketi but maybe not
Thanks for your time
once that's done
these would be the configs you need in laravel to connect