Can you help us find out why Tornado 31. does not work? On Sunday, 6 October 2013 21:24:29 UTC-5, Junior Phanter wrote: > > Sorry my bad english, > > Analyzing the web2py_websocket inside web2py.js. I noticed that when I > used: > > <script> > $(document).ready(function(){ > var data; > web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup', > function(e){data=eval('('+e.data+')')}); > }); > </script> > > > the browser console accused the "web2py_websocket was not a function", so > I changed the code to: > > <script> > $(document).ready(function(){ > var data; > $.web2py.web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup', > function(e){data=eval('('+e.data+')')}); > }); > </script> > > worked perfectly! > > > I changed it to Tornado 3.0 (Tornado 3.1.1 not work) and web2py 2.7.1. > > > 2013/10/4 Junior Phanter <junior...@gmail.com <javascript:>> > >> greetings , >> sorry my bad english , I 'm trying to implement a chat using the tornado >> and websocket_messaging.py , but I'm having trouble hearing the tornado >> server . the server receives the tornado MESSAGES using : >> >> websocket_send ( ' http://127.0.0.1:8888 ', ' Hello World ', ' mykey ', >> ' mygroup ' ) >> >> but the script : >> ----------------------------------------------------------------- >> <script> >> $(document).ready(function(){ >> var data; >> web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup >> ',function(e){data=eval('('+e.data+')')}); >> }); >> </script> >> ------------------------------------------------------------------------- >> does not capture the listener . >> >> I tested the application that comes as an example within the >> websocket_messaging.py and neither worked . >> >> --------------------- exemplo dentro do websocket_messaging.py >> -------------------------- >> >> Here is a complete sample web2py action: >> >> def index(): >> form=LOAD('default','ajax_form',ajax=True) >> script=SCRIPT(''' >> jQuery(document).ready(function(){ >> var callback=function(e){alert(e.data)}; >> if(!web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup >> ',callback)) >> alert("html5 websocket not supported by your browser, try >> Google Chrome"); >> }); >> ''') >> return dict(form=form, script=script) >> >> def ajax_form(): >> form=SQLFORM.factory(Field('message')) >> if form.accepts(request,session): >> from gluon.contrib.websocket_messaging import websocket_send >> websocket_send( >> 'http://127.0.0.1:8888 >> ',form.vars.message,'mykey','mygroup') >> return form >> >> >> ----------------------------------------------------------------------------------------------------- >> >> >> >> I'm using the Tornado 2.1 and 2.6.4 web2py >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > >
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.