I saw the console and there were these error messages, I thought it might help:
1375413960.5:MESSAGE to display:12 ERROR:tornado.application:Uncaught exception POST / (127.0.0.1) HTTPRequest(protocol='http', host='127.0.0.1:8888', method='POST', uri='/', version='HTTP/1.0', remote_ip='127.0.0.1', headers={'Content-Length': '67', 'Content-Type': 'application/x-www-form-urlencoded', 'Host': '127.0.0.1:8888', 'User-Agent': 'Mozilla/4.0'}) Traceback (most recent call last): File "/Library/Python/2.7/site-packages/tornado/web.py", line 1155, in _when_complete raise ValueError("Expected Future or None, got %r" % result) ValueError: Expected Future or None, got 'true' ERROR:tornado.access:500 POST / (127.0.0.1) 0.63ms On Friday, August 2, 2013 11:07:19 AM UTC+8, lyn2py wrote: > > I am trying the websocket on google chrome and encountered this error: > > Uncaught TypeError: Property 'web2py_websocket' of object [object Object] > is not a function > > I have followed the instructions. What could I be doing wrong? > > Thanks! > > On Friday, July 26, 2013 10:48:07 PM UTC+8, Massimo Di Pierro wrote: >> >> the basic idea of websocket is that input data must be validated by >> web2py therefore data can only be received from web2py. >> >> >> In your JS code you simply do: >> >> <script> >> >> $(document).ready(function(){ >> >> >> if(!web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup',function(e){alert(e.data)})) >> >> >> alert("html5 websocket not supported by your browser, try Google >> Chrome"); >> }); >> >> </script> >> >> This makes the client join the group "mygroup" and is data is received, >> the callback function is called. >> You post by doing an ajax to web2py and web2py does >> >> from gluon.contrib.websocket_messaging import websocket_send >> >> websocket_send('http://127.0.0.1:8888','Hello World','mykey','mygroup') >> >> This sends the message "hello world" to all the members of the group >> "mygroup". >> >> Notice that web2py and websocket share a "mykey". This is how security is >> implemented. web2py validates input and it knows the key for posting. the >> only way to allow posting directly from JS would be to remove this security >> step or creating some authentication at the JS level. I do not trust >> authentication at the JS level. >> >> >> >> >> >> On Friday, 26 July 2013 09:08:37 UTC-5, Eduardo Cruz wrote: >>> >>> Is there a way to send data to a websocket from javascript >>> using web2py_websocket ? >> >> -- --- 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.