@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)
<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>