Powered by Tornado, MySQL, Redis, Bootstrap, jQuery.
- Tornado: Use long polling, rather than WebSocket.
- MySQL: Store user informations,UUIDs that is what email verification and password recovery need.
- Redis:Store online users, and through Pub-Sub to push online/offline messages, chat messages.
- AJAX: Verify forms, including sign-up, log-in, password recovery, etc.
- Email Verification: Sign-up, password recovery.
- Online/offline: Use long polling to indicate user if online.
- New Messages: If received message from the user is not current chat user, show the number of unread message. Otherwise, show messages in chat box. In addition, pictures is ok!
- Robot: Use API http://www.tuling123.com/openapi/cloud/access_api.jsp
-
Clone the repo.
pip install -r requirements.txt
. You must installMySQL
andRedis
. -
Set
from_addr
(email address),from_pwd
(email passwrod) androbot_key
(See http://www.tuling123.com/openapi/cloud/access_api.jsp) inchat_share.conf
. -
MySQL
mysql -u root -p < chat.sql
. -
ln -s chat_share.conf chat.conf
or renamechat_share.conf
tochat.conf
. -
python app.py
orchmod +x app.py
then./app.py
. -
Enjoy it, and star the repo ~
- Robot: http://www.tuling123.com/openapi/cloud/access_api.jsp
- When sending email, page would blocking, maybe task queue?
- When user offline, clear up messages?
- Through other sites of OAuth login?
- A kinds of BUGs,to be continued O(∩_∩)O~
- Get all users when enter chat room. (Solution: Extract some code and make it reusable.)
- User online status is unstable. (Solution: Use Redis hash table store username with timestamp and use
IOLoop.add_timeout
given user a chance to reconnect quickly.)