Not working on android
masudhossain opened this issue · 7 comments
It seems this works 100% fine in iOS, but not on Android.
The messages will still send successfully, but it won't output unto the react native app.
I have a problem in Android. It works when working in development with ws://localhost:3000/cable
but does not work with wss://myapp.com/cable
. Just in android. Is this related?
@jjercx not 100% sure if it's related because I'm not using localhost. but it def doesn't work for me on a live server.
This issue was resolved, but i don't get the same results: #15
For me, it's sending the messages correctly, but the connection is false. So it's making the SOCKET connection (i think?), but it's not able to output it on the screen.
My problem was resolved with Action Cable configuration on the Rails side.
@jjercx what did you do on the rails side to fix it?
@jorgeants i didn't, unfortunately. I would advise just using pusher.com tbh.
@jorgeants @masudhossain sorry for the late response. I had no problems using this lib with rails, besides this issue. This config helped me:
Development:
# config/environments/development.rb
config.action_cable.mount_path = '/cable'
config.action_cable.url = 'ws://localhost:3000/cable'
config.action_cable.disable_request_forgery_protection = true
Production:
#config/environments/production.rb
config.action_cable.mount_path = '/cable'
config.action_cable.url = ENV['HOST'].sub('http','ws').concat('/cable')
config.action_cable.disable_request_forgery_protection = true
If it doesn't do the trick I can dig more, maybe I changed other thing somewhere else.