I followed the video of Mr Bruno Rocha to implement simple websocket, the controller is very simple: @auth.requires_login() def index(): form = SQLFORM(Post, formstyle='divs') if form.process().accepted: websocket_send('http://127.0.0.1:8888', 'hello', 'mykey', 'mygroup') pass messages = db(Post).select(orderby=~Post.created_on) return dict(form=form, messages=messages)
and in the view: <script> $(document).ready(function(){ if(!$.web2py.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> but when i open the view the server prints exceptions showed in the error_log file. Any Help Please?? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b3cc38bb-796e-4fd9-9fcb-7f60518d7b1e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
C:\web2py_src>python gluon/contrib/websocket_messaging.py -k mykey -p 8888 ERROR:tornado.application:Uncaught exception in /realtime/mygroup Traceback (most recent call last): File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\websocket.py", line 322, in wrapper return callback(*args, **kwargs) File "gluon/contrib/websocket_messaging.py", line 156, in open group, token, name = params.split('/') + [None, None] TypeError: a bytes-like object is required, not 'str' ERROR:tornado.application:Uncaught exception, closing connection. Traceback (most recent call last): File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\iostream.py", line 354, in wrapper callback(*args) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 331, in wrapped raise_exc_info(exc) File "<string>", line 3, in raise_exc_info File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 302, in wrapped ret = fn(*args, **kwargs) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\httpserver.py", line 218, in _on_connection_close callback() File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 331, in wrapped raise_exc_info(exc) File "<string>", line 3, in raise_exc_info File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 302, in wrapped ret = fn(*args, **kwargs) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\websocket.py", line 293, in on_connection_close self.on_close() File "gluon/contrib/websocket_messaging.py", line 179, in on_close if self.group in listeners: AttributeError: 'DistributeHandler' object has no attribute 'group' ERROR:tornado.application:Exception in callback functools.partial(<function wrap.<locals>.wrapped at 0x038A2E88>) Traceback (most recent call last): File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\ioloop.py", line 477, in _run_callback callback() File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 331, in wrapped raise_exc_info(exc) File "<string>", line 3, in raise_exc_info File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 302, in wrapped ret = fn(*args, **kwargs) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\iostream.py", line 354, in wrapper callback(*args) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 331, in wrapped raise_exc_info(exc) File "<string>", line 3, in raise_exc_info File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 302, in wrapped ret = fn(*args, **kwargs) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\httpserver.py", line 218, in _on_connection_close callback() File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 331, in wrapped raise_exc_info(exc) File "<string>", line 3, in raise_exc_info File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\stack_context.py", line 302, in wrapped ret = fn(*args, **kwargs) File "C:\Users\alidm\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\websocket.py", line 293, in on_connection_close self.on_close() File "gluon/contrib/websocket_messaging.py", line 179, in on_close if self.group in listeners: AttributeError: 'DistributeHandler' object has no attribute 'group'