Web2py Websocket in Rest

245 views
Skip to first unread message

PK

unread,
Feb 14, 2017, 12:54:07 AM2/14/17
to web2py-users
i tried to use web2py as backend websocket and front end Android Java. CAN I USE websocket messaging in web2py to use real time application ???how should i generate Json data?

nexus...@gmail.com

unread,
Feb 14, 2017, 3:43:25 PM2/14/17
to web2py-users
while you can make a restful api with web2py you can't do websocket with web2py
you will need an async web server with a non blocking framework (something like tornado ...)

if you will only request resources using websockets there is no benefit from using web2py
but if you want to use websockets along side a web application you can read this example
https://github.com/web2py/web2py/blob/master/gluon/contrib/websocket_messaging.py
Message has been deleted

PK

unread,
Feb 17, 2017, 7:39:58 AM2/17/17
to web2py-users
I wanna use real time chatting application with web2py but my front end is android app.So i have to send Rest Json data.Should i use web2py and tornado something like web_socketmessaging.py or should i only use tornado.

nexus...@gmail.com

unread,
Feb 18, 2017, 3:34:32 AM2/18/17
to web2py-users
it depends
you can use tornado web framework.
but if you want to make a complete website and chatting is one of it's features
then it's better to use both in order to benefit from web2py features .

but either way you have to start by learning how to use tornado.websocket and then you'll
be able to decide if you'll use websocket_messaging.py
Reply all
Reply to author
Forward
0 new messages