Giter VIP home page Giter VIP logo

wechat's Introduction

Chat Room

Robot, TaskQueue, Tornado, Redis, MySQL, Bootstrap, jQuery, Requests and more(To Be Continued...).

效果预览


Summary

  • 基于Redis的简单任务队列 taskq and doc,任务顺序执行,没有优先级......... 如果单独拿出来用千万要看**README**!!!
  • Tornado提供Web后端服务,前端使用jQueryBootstrap(太没新意了...)。
  • MySQL来存储注册用户信息、邮箱验证和密码找回的UUID
  • Redis存储在线用户以及聊天信息。
  • 邮箱用来验证注册用户和密码找回。
  • 实时上下线消息、聊天消息的推送使用长轮询(或许考虑使用 WebSocket)结合Redis的 Pub-Sub 功能。如果消息来自当前正在聊天的用户,直接显示,否则显示未读数;图片消息经过 JavaScript base64 编码后传送到服务端。
  • 机器人功能使用 http://www.tuling123.com/openapi/cloud/access_api.jsp 的 API,这里只提供文本类消息回复,其它类型都被替换了。

Setup

  1. 项目依赖于MySQLRedismysql -u root -p < chat.sql初始化数据库;pip install -r requirements.txt解决Python 2.7.x依赖。

  2. 邮箱需要支持 SMTP,在chat_share.conf设置好from_addr(邮箱地址)、from_pwd(邮箱密码)和smtp_server(SMTP 服务器地址);机器人需要设置chat_share.conf里的robot_key,自己申请...

  3. chat_share.conf创建一个符号链接(Win 下的快捷方式)为chat.confln -s chat_share.conf chat.conf)或者直接重命名。主要是这部分涉及私密信息,万一提交了就... 所以本地还有一份chat_dev.conf

  4. 注册登录发送邮件需要启动任务队列:cd taskq/(在taskq目录下执行)python executor.py,详情见taskq

  5. 跑起来: python app.py或者chmod +x app.py ./app.py

  6. 第一步 Star 然后 Clone/Download ~(@^_^@)~~


TO-DO

  • 用户在线状态不稳定。(2015/8/13解决: 使用 Redis 的 HashTable 存储上线用户信息和一个时间戳,并在RequestHandler().on_connection_close()时使用IOLoop().add_timeout()给用户一个机会快速的重连)
  • 发送邮件的时候阻塞太明显了,使用任务队列?(2015/8/22解决:土制了一个简单的任务队列,见:关于 Web 服务中的耗时后台任务的意淫 & taskq
  • Redis 默认异步的保存数据到本地,或许用户下线多久后自动将消息清除掉。
  • 通过其它网站的 OAuth 登录?就是个简单聊天室又咋地啦?
  • 邮件验证、密码找回 UUID(或者其它)失效时间?
  • 命令行(或Android)客户端,恩,这个好!

LICENSE

The BSD 3-Clause License

Pictures

Old English Version

wechat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.