Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket in Android doesn't work #6

Open
haozeng opened this issue Jun 21, 2017 · 2 comments
Open

WebSocket in Android doesn't work #6

haozeng opened this issue Jun 21, 2017 · 2 comments

Comments

@haozeng
Copy link

haozeng commented Jun 21, 2017

Description

We have React-Native app built for both IOS and Android. The websocket works well with IOS. But when we are testing in android, it always says failed to upgrade to WebSocket.

Here are some logs we read both from backend server for IOS and Android. Not able to capture any useful logs when websocket connection is built from the mobile side.

The backend is rails 5 with action cable and on mobile side, we are using a library that uses actioncable API (https://github.com/schneidmaster/action-cable-react)

Any feedback is greatly appreciated.

2017-06-21T23:05:05.850190+00:00 heroku[router]: at=info method=GET path="/cable" host=anyperk-wellness.herokuapp.com request_id=911403d4-64f7-472b-83fd-6a31780deac5 fwd="4.16.194.94" dyno=web.1 connect=0ms service=3ms status=404 bytes=429 protocol=https
2017-06-21T23:05:05.846086+00:00 app[web.1]: I, [2017-06-21T16:05:05.846002 #4]  INFO -- : [911403d4-64f7-472b-83fd-6a31780deac5] Started GET "/cable" for 4.16.194.94 at 2017-06-21 16:05:05 -0700
2017-06-21T23:05:05.846932+00:00 app[web.1]: I, [2017-06-21T16:05:05.846873 #4]  INFO -- : [911403d4-64f7-472b-83fd-6a31780deac5] Started GET "/cable/" [WebSocket] for 4.16.194.94 at 2017-06-21 16:05:05 -0700
2017-06-21T23:05:05.847023+00:00 app[web.1]: E, [2017-06-21T16:05:05.846970 #4] ERROR -- : [911403d4-64f7-472b-83fd-6a31780deac5] Request origin not allowed: https://anyperk-wellness.herokuapp.com/
2017-06-21T23:05:05.847112+00:00 app[web.1]: E, [2017-06-21T16:05:05.847051 #4] ERROR -- : [911403d4-64f7-472b-83fd-6a31780deac5] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
2017-06-21T23:05:05.847181+00:00 app[web.1]: I, [2017-06-21T16:05:05.847134 #4]  INFO -- : [911403d4-64f7-472b-83fd-6a31780deac5] Finished "/cable/" [WebSocket] for 4.16.194.94 at 2017-06-21 16:05:05 -0700
2017-06-21T23:06:04.870791+00:00 app[web.1]: I, [2017-06-21T16:06:04.870693 #4]  INFO -- : [748b96e8-217b-4435-9c7b-242f7924f69a] Started GET "/cable" for 166.137.242.115 at 2017-06-21 16:06:04 -0700
2017-06-21T23:06:04.871459+00:00 app[web.1]: I, [2017-06-21T16:06:04.871404 #4]  INFO -- : [748b96e8-217b-4435-9c7b-242f7924f69a] Started GET "/cable/" [WebSocket] for 166.137.242.115 at 2017-06-21 16:06:04 -0700
2017-06-21T23:06:04.871532+00:00 app[web.1]: I, [2017-06-21T16:06:04.871492 #4]  INFO -- : [748b96e8-217b-4435-9c7b-242f7924f69a] Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
@schneidmaster
Copy link
Owner

Hi -- this package is deprecated and may not work with the latest versions of React. I recommend replacing with react-actioncable-provider which offers similar functionality using a higher-order component and is up to date with the latest versions.

@kesha-antonov
Copy link

Hey guys!
Consider using my fork: https://github.com/kesha-antonov/react-native-action-cable
And also please mention it in the README

Seems like people love it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants