I followed a video by Mr Bruno Rocha here to implement simple websocket, but When i run the app I get the following exception:
AttributeError: 'DistributeHandler' object has no attribute 'group'
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)
In the view I do the Following to get the message:
$(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");
});
When the user send a message the message arrives to the server (e.g I can see it) but when I reload the page the following exceptions occur, error log , looks like the problem happens when the server send the received message to the group, Any help please??
it turns out the problem happens because of the version 3.2.1 of tornado framework but when i updated to the latest version which is 6.0.3, it works like a charm..