react-native-actioncable icon indicating copy to clipboard operation
react-native-actioncable copied to clipboard

Not working on android

Open masudhossain opened this issue 7 years ago • 8 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.

masudhossain avatar Sep 01 '18 19:09 masudhossain

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 avatar Sep 03 '18 19:09 jjercx

@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: https://github.com/cpunion/react-native-actioncable/issues/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.

masudhossain avatar Sep 08 '18 18:09 masudhossain

My problem was resolved with Action Cable configuration on the Rails side.

jjercx avatar Sep 10 '18 18:09 jjercx

@jjercx what did you do on the rails side to fix it?

masudhossain avatar Sep 11 '18 08:09 masudhossain

@jjercx what did you do on the rails side to fix it? (2)

jorgeants avatar Mar 03 '19 16:03 jorgeants

@jorgeants i didn't, unfortunately. I would advise just using pusher.com tbh.

masudhossain avatar Mar 05 '19 08:03 masudhossain

@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.

jjercx avatar Mar 05 '19 17:03 jjercx