This logic was added somewhat recently and I did not test it myself but 
reading the code it seems it should work this way:

1) run websocket_messaging.py  -t to enable the token message
2) post a message to the /token API with a message containing a made up 
UUID token. This will create a token on the server
3) when connecting instead of 

   ws://127.0.0.1:8888/realtime/mygroup


use


   ws://127.0.0.1:8888/realtime/mygroup/<token>


because of -t , the <token> must match one of the registered token and no 
other client must be using it for a connection. Notice that in 2 the /token 
api is meant to be called by the web2py server. Works like the post 
handler. The message is supposed to be created and signed using the server 
password.


The idea is when a new cllient accesses the web app, the server create a on 
time token for that client, gives it to the client (via normal web2py 
means, embedding in the pages, etc.) and registers it with the 
websocket_server. The latter then checks the token when the client tries to 
connect. 

On Tuesday, 14 July 2015 20:54:32 UTC-5, Samuel Sowah wrote:
>
> Can someone please explain how to use websocket_messaging.py properly with 
> tokens?
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to