Closed shashi-we closed 6 years ago
I figured it out. On production I was using ws://localhost:8080/cable
as action_cable url. When I changed to ws://server_ip:8080/cable
, it worked as expected. I didn't find anything regarding this particular thing in documentation though.
It might be because the one who accessed the websocket is user's browser not inside the server, so the url path must be webserver domain name or webserver ip address. I am not sure though.
Closing this for now as it's fixed. :)
Thanks again for this gem! :+1:
I didn't find anything regarding this particular thing in documentation though.
We have a note about setting action_cable url here. But it's a little bit confusing right now, I'll change localhost
to something else.
Thanks for the feedback!
Thanks for the response.
I didn't find anything regarding this particular thing in documentation though.
Yes, I saw that action_cable url in document. I meant to say that I didn't find anything like we need to use server's ip address instead of localhost. 'localhost' didn't work for me on server.
Hi @palkan I am stuck with one issue. The RPC server stops frequently. It only run for few minutes. Then I need to run it again. I tried to use 'hivemind' for Procfile which was not helpful either.
Content of Procfile for production:
rpc: RAILS_ENV=production ./bin/anycable
go: sleep 5 && anycable-go -rpc=0.0.0.0:50051 -headers=cookie,x-api-token -redis=redis://localhost:6379/5 -redis_channel=anycable -addr=0.0.0.0:8080
Can you please help me to know how can I make './bin/anycable' command persistent?
Thanks,
Which version do you use?
Do you see any errors in the log?
Thanks for reply.
I am using 0.5.2.
I didn't see any error except following lines:
rpc | Running...
rpc | Process exited
This is the message logged into output file with hivemind Procfile >> anycable.log
@palkan I am not sure if it help but this is working on my local machine in production environment with exact same setting. The issue is on production only.
Hm, there should be at least "RPC server is listening on xxx" info message. Looks like the script is not running at all.
Are you able to launch RAILS_ENV=production ./bin/anycable
manually on your production server?
Yes, I can run RAILS_ENV=production ./bin/anycable
but it stops in few minutes. I tried it with '&' also but still not persistent.
but it stops in few minutes.
And no output at all?
Could you try to run it ANYCABLE_DEBUG=1
? And, maybe, without RAILS_ENV=production
.
Hi @palkan thanks for your great work for anycable. :+1:
I have implemented it in a rails project for my client. I was able to run anycable on my local machine in development mode as well in production mode.
But when I tried to run it on server with same configuration/settings, it didn't work. I am seeing following error message in browser's console:
WebSocket connection to 'ws://localhost:8080/cable' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I am using Capistrano for deployment.
I am running WS server with following anycable-go command:
anycable-go -rpc=0.0.0.0:50051 -headers=cookie,x-api-token -redis=redis://localhost:6379/5 -redis_channel=anycable -addr=0.0.0.0:8080 -log
and for rpc:
RAILS_ENV=production ./bin/anycable
Is there any specific setting I need to do for capistrano?
I'd be grateful for any help or suggestion on this.
Thanks