Yes and no. websocket_messaging is designed to deliver messages from the server to the clients. Clients communicate by sending messages to the web2py server which then sends to the websocket_messaging for delivery. The process of posting messages does not require a connection to the websocket_messaging and security is handled by web2py in the usual way. Communication between web2py and websocket_messagingis signed using the key. The token only restricts who can signup for receiving messages from websocket_messaging
As you suggested you could create a token wen a user logs into web2py and register it with websocket_server using the token api. You need to communicate it to the app. You can do for example: <script> $(document).ready(function(){ if(!$.web2py.web2py_websocket('ws://127.0.0.1:8888/realtime/{{=session.group}}/{{=session.token}}', function(e){alert(e.data)})) alert("html5 websocket not supported by your browser, try Google Chrome"); }); </script> On Wednesday, 15 July 2015 14:24:08 UTC-5, Dave S wrote: > > > > On Wednesday, July 15, 2015 at 11:40:08 AM UTC-7, Massimo Di Pierro wrote: >> >> [...] >> > Each client must have a unique token and pass it in the ws:// connection >> string when it connects. If it up to you to make up tokens. They can be >> random numbers, uuid, etc. You have to give a token to the clients and you >> have to register the tokens with websocket_server via the /token api. >> > > For instance, with web2py you enforce user login (@auth-login-required), > and when the login succeeds you generate a token (e.g., uuid.uuid4()), > perhaps adding it to the session data and using it when accepting message > forms? > > /dps > > > -- 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/d/optout.