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 get transports demo to work #4

Closed
hjwp opened this issue Nov 7, 2011 · 9 comments
Closed

can't get transports demo to work #4

hjwp opened this issue Nov 7, 2011 · 9 comments

Comments

@hjwp
Copy link

hjwp commented Nov 7, 2011

seems to serve the main page OK, as well as socket.io.js. when I click "connect" though, it logs "connecting" but doesn't get any further. same in firefox & chromium.

in the server logs, I see:

2011-11-07 16:35:44,642 INFO:Starting up tornadio server on port '8001'                                       
2011-11-07 16:35:44,643 INFO:Starting Flash policy server on port '843'                                       
2011-11-07 16:35:44,643 INFO:Entering IOLoop...                                                               
2011-11-07 16:36:29,634 INFO:200 GET / (192.168.0.181) 4.91ms                                                 
2011-11-07 16:36:29,729 INFO:200 GET /socket.io.js (192.168.0.181) 21.00ms

On the client-side, if I open up the firebug console, I see it tries to make a bunch of ajax GET requests to, eg:

http://localhost:8001/socket.io/1/?t=1320683800628

but it doesn't receive a response.

enabling & disabling the various different transport types doesn't seem to make a difference

python 2.6 on debian, FF 7.0.1, Chromium 14.0.835.202 (Developer Build 103287 Linux)

I realise it's early days! any ideas what might be going wrong?

@mrjoes
Copy link
Owner

mrjoes commented Nov 7, 2011

No idea - should work without any problems. Do you see any javascript errors?

@hjwp
Copy link
Author

hjwp commented Nov 7, 2011

wait! i think i'm being an idiot... am running the server on a different machine to the client...

@hjwp
Copy link
Author

hjwp commented Nov 7, 2011

hm.... some progress, but still no protocols seem to connect. will post detailed error shortly.

@hjwp
Copy link
Author

hjwp commented Nov 7, 2011

trying with server localhost - websockets works fine, other transports not so good:

flashsocket:

GET http://localhost:8001/socket.io/1/?t=1320684913652
[WebSocket] swfobject.embedSWF failed
console.error("[WebSocket] swfobject.embedSWF failed"); 

fallback to jsonp etc - client side errors:

server-side errors:

DEBUG:root:Initializing xhr-polling transport.
ERROR:root:Uncaught exception GET /socket.io/1/xhr-polling/0628c8c60ffeaf84b087cff5d18af108?t=1320685147951 (127.0.0.1)
HTTPRequest(protocol='http', host='localhost:8001', method='GET', uri='/socket.io/1/xhr-polling/0628c8c60ffeaf84b087cff5d18af108?t=1320685147951', version='HTTP/1.1', remote_ip='127.0.0.1', body='', headers={'Accept-Language': 'en-gb,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'Host': 'localhost:8001', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8001/', 'Cookie': 'csrftoken=1efef016fa01c32080a7de982730e3d9'})
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado-2.1.1-py2.7.egg/tornado/web.py", line 1040, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/TornadIO2-0.0.1-py2.7.egg/tornadio2/polling.py", line 115, in get
    self.session.flush()
  File "/usr/local/lib/python2.7/dist-packages/TornadIO2-0.0.1-py2.7.egg/tornadio2/session.py", line 140, in flush
    self.handler.send_messages(self.send_queue)
  File "/usr/local/lib/python2.7/dist-packages/TornadIO2-0.0.1-py2.7.egg/tornadio2/polling.py", line 145, in send_messages
    data = proto.encode_frames(messages)
  File "/usr/local/lib/python2.7/dist-packages/TornadIO2-0.0.1-py2.7.egg/tornadio2/proto.py", line 239, in encode_frames
    frames += '%s%d%s%s' % (FRAME_SEPARATOR, len(p), FRAME_SEPARATOR, p)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
ERROR:root:500 GET /socket.io/1/xhr-polling/0628c8c60ffeaf84b087cff5d18af108?t=1320685147951 (127.0.0.1) 0.72ms
DEBUG:root:Initializing jsonp transport.
WARNING:root:401 GET /socket.io/1/jsonp-polling/646ddd91252dbd498b74830589209a76?t=1320685150585&i=0 (127.0.0.1) 1.07ms
DEBUG:root:Initializing jsonp transport.
WARNING:root:401 GET /socket.io/1/jsonp-polling/0628c8c60ffeaf84b087cff5d18af108?t=1320685157964&i=1 (127.0.0.1) 0.66ms

@mrjoes
Copy link
Owner

mrjoes commented Nov 7, 2011

Try grabbing new Tornadio2 from github - I found issue which might prevent
transports example from working. It is basically one you reported.

Also, support for hybi17 is not in Tornado yet (well, it is, but in Tornado
head), so you might expect some slow down with websocket transport till it
will switch to the xhr-polling.

Thanks,
Serge.

On Mon, Nov 7, 2011 at 6:52 PM, hjwp <
reply@reply.github.com>wrote:

hm.... some progress, but still no protocols seem to connect. will post
detailed error shortly.


Reply to this email directly or view it on GitHub:
#4 (comment)

@hjwp
Copy link
Author

hjwp commented Nov 7, 2011

since websockets works ok with a local server, I thought I'd try it on the server. I modify transports/index.html to use

conn = io.connect('http://' + window.location.hostname + ':8001/', {

and I get the following stack trace on attempting to make a websockets connection:

{'t': ['1320685739774']}
DEBUG:root:<<< 3:::Welcome from the server.
DEBUG:root:<<< 1::
INFO:root:200 GET /socket.io/1/?t=1320685739774 (192.168.0.181) 0.77ms
DEBUG:root:Initializing websocket handler.
DEBUG:root:Malformed WebSocket request received
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0-py2.6.egg/tornado/iostream.py", line 235, in wrappe
r
    callback(*args)
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0-py2.6.egg/tornado/stack_context.py", line 159, in w
rapped
    callback(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0-py2.6.egg/tornado/websocket.py", line 204, in on_co
nnection_close
    self.on_close()
  File "/usr/local/lib/python2.6/dist-packages/TornadIO2-0.0.1-py2.6.egg/tornadio2/persistent.py", line 53, in
 on_close
    self._detach()
  File "/usr/local/lib/python2.6/dist-packages/TornadIO2-0.0.1-py2.6.egg/tornadio2/persistent.py", line 39, in
 _detach
    if self.session is not None:
AttributeError: 'TornadioWebSocketHandler' object has no attribute 'session'

@hjwp
Copy link
Author

hjwp commented Nov 7, 2011

sorry if that was all a bit stream-of-consciousness. hope some of it helps.

@mrjoes
Copy link
Owner

mrjoes commented Nov 7, 2011

What version of Tornado you're using?

Thanks for bug report though, if Tornado can't parse websocket handshake,
it still calls on_close.

On Mon, Nov 7, 2011 at 7:13 PM, hjwp <
reply@reply.github.com>wrote:

sorry if that was all a bit stream-of-consciousness. hope some of it
helps.


Reply to this email directly or view it on GitHub:
#4 (comment)

@mrjoes mrjoes closed this as completed Nov 10, 2011
@hjwp
Copy link
Author

hjwp commented Nov 11, 2011

Hey, just to let you know I finally got a chance to take another look at this, and upgrading tornado to the latest version worked (we had it pinned at 2.0)... things are looking good!

can I make a recommendation for a change to your transports demo: in index.html, line 32:

conn = io.connect('http://localhost:8001/', {

to become

conn = io.connect('http://' + window.location.hostname + ':8001/', {

allows server-based test to work transparently...

mdineen pushed a commit to mdineen/tornadio3 that referenced this issue Jun 30, 2021
Send debug logs when a protocol change is triggered.
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