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

ios device "websocket: connection error" #846

Closed
shilman opened this issue Apr 15, 2017 · 16 comments
Closed

ios device "websocket: connection error" #846

shilman opened this issue Apr 15, 2017 · 16 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 15, 2017

Issue by rohit-ravikoti
Wednesday Feb 08, 2017 at 21:19 GMT
Originally opened as storybook-eol/react-native-storybook#122


Hi,
I'm not sure if this functionality is supported, but when I try to run the app on a real ios device, I get the following error:

2017-02-08 13:18:52.831 [error][tid:com.facebook.react.JavaScript] 'websocket: connection error', 'The operation couldn’t be completed. Connection refused'
2017-02-08 13:18:52.865 [error][tid:com.facebook.react.JavaScript] 'websocket: connection closed', undefined, undefined
@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by admmasters
Thursday Mar 02, 2017 at 22:59 GMT


E

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by chrismcleod
Saturday Mar 04, 2017 at 21:20 GMT


@rohit-ravikoti
This is because react native uses "localhost" as the default port for the packager. This doesn't work for react native storybook. I'm guessing because it expects that the storybook server is running on the same host as the packager. However, the storybook host is not on the ios device, it is on your development computer. So, replace all the localhost references with your computer's internal IP address. That can be found by going to System Settings > Network.

If your internal ip address is 10.0.1.16:

open your react native project with XCode and go to:
ProjectName > Libraries > RCTWebSocket.xcodeproj > RCTWebSocketExecutor.m

got to the method - (void)setUp and (toward the top) change
host = @"localhost" to host = @"10.0.1.16".

image

create storybook like this:
const StorybookUI = getStorybookUI({ port: 7007, host: "10.0.1.16" });

start it like this:
npm run storybook -- -h 10.0.1.16

After making all the changes, I'd probably close all simulators, stop all packagers and close the app on the phone.

@notgiorgi
Copy link

Isn't there some more general approach? So that the whole team won't have to do that separately?

@DoubleOTheven
Copy link

DoubleOTheven commented Oct 20, 2017

I'm on project using CRNA, so XCode is not an option without ejecting. It would be great to have an alternative solution

@chmaltsp
Copy link

chmaltsp commented Nov 15, 2017

This would be amazing to have in some kind of build step when running the packager.

@ndelangen
Copy link
Member

Would any of you be able to open a PR for this @notgiorgi @Sonblind @chmaltsp ?

@chmaltsp
Copy link

@ndelangen I could give it a shot, but I'm unsure of how to inject into the local IP into RCTWebSocketExecutor.m

@stale
Copy link

stale bot commented Dec 30, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 60 days. Thanks!

@stale stale bot added the inactive label Dec 30, 2017
@stale
Copy link

stale bot commented Jan 14, 2018

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jan 14, 2018
@devtanc
Copy link

devtanc commented Feb 7, 2018

This is still an issue. I was able to fix with the suggestions, but it's not going to work as either a long-term fix, or a fix for a team of developers.

@rdewolff
Copy link

rdewolff commented Jun 2, 2018

Yeah this this issue isn't resolved, should be left open until resolved. The provided solution is an ugly workaround.

@hariDasu
Copy link

this issue should remain open. until this is resolved I find it impractical to use storybook in an RN application. the "speed to development" promise of storybook is greatly reduced by this arduous and time consuming process.

@stale
Copy link

stale bot commented Mar 29, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Mar 29, 2019
@stale
Copy link

stale bot commented Apr 28, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Apr 28, 2019
@shilman shilman reopened this Apr 28, 2019
@stale stale bot removed the inactive label Apr 28, 2019
@shilman
Copy link
Member Author

shilman commented Apr 28, 2019

@benoitdion not sure if you've seen this...

@Gongreg
Copy link
Member

Gongreg commented May 16, 2019

Currently you have an option to pass host as a param to getStorybookUI. It is a lot better solution than the one recommended here. Later on we could try to implement some screen to allow user to insert custom IP, but for now it should work. I am closing this issue and opening a feature request.

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

No branches or pull requests

9 participants