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

Can't run TestChat on python server #405

Open
sashakid opened this issue Jun 8, 2016 · 5 comments
Open

Can't run TestChat on python server #405

sashakid opened this issue Jun 8, 2016 · 5 comments

Comments

@sashakid
Copy link

sashakid commented Jun 8, 2016

Hi, can't run python server for testing, while make test:

The file .../SocketRocket-master/pages/results/index.html does not exist.
make: *** [test] Error 1

Then I run server:

Listening on 0.0.0.0:9000

And receiving:

Error Domain=SRWebSocketErrorDomain Code=2145 "Error writing to stream." UserInfo={NSLocalizedDescription=Error writing to stream., NSUnderlyingError=0x147591480 {Error Domain=NSPOSIXErrorDomain Code=9 "Bad file descriptor"}}

Am I doing something wrong? I'm trying to connect to "0.0.0.0:9000"URL in TestChat iOS app

@nlutsenko
Copy link
Contributor

Hey @sashakid,
Try connecting to localhost:9000 instead of 0.0.0.0.

We are in the process of revamping how tests are set up and being run, so everyone can run them regardless of their local environment. Also, you can try patching #403 locally, so it's runnable.

I wouldn't recommend relying on Makefile to set up anything at the current moment.

@sashakid
Copy link
Author

sashakid commented Jun 9, 2016

@nlutsenko nothing changes, please, check my screenshot:

screenshot_

@sashakid sashakid changed the title Can't run python server for testing Can't run TestChat on python server Jun 9, 2016
@sashakid
Copy link
Author

sashakid commented Jun 9, 2016

Just didn't noticed in python code right URL

    application = tornado.web.Application([
        (r"/chat", ChatHandler),
        (r"/(.*)", tornado.web.StaticFileHandler, {"path": args.static_path, "default_filename":'index.html'}),
    ])

So the right URL to connect from iOS client is [NSURL URLWithString:@"ws://localhost:9000/chat"]

@nlutsenko
Copy link
Contributor

(-‸ლ) That'll do it.
Did you get it working? If yes - I would gladly review the PR that updates the iOS client to the proper URL.

@sashakid
Copy link
Author

sashakid commented Jun 10, 2016

Yes, it's working. I think you should mention it in your tutorial because it's not obvious for beginners or whom is not strong in networking like me :-)

So, if you decide to test iOS client in simulator you should connect to @"ws://localhost:9000/chat" and check the same URL in python server code in this line:39 parser.add_argument('-i', '--listen-interface', help='interface to listen on. [default: %(default)s]', default='localhost', metavar='IFACE').

But if you want to test on real device (only in case if the device and server machine are in the same network), you should change URL to your local network IP both in iOS client code and python server code, for example @"ws://YOUR_LOCAL_IP:9000/chat" and in python code ...default='YOUR_LOCAL_IP'...

For now it's '0.0.0.0'in python code, don't know what's the difference between localhost and 0.0.0.0 :-)

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

2 participants