Coder Social home page Coder Social logo

webchat's Introduction

web chat use websocket

需要的依赖

mysql, redis
golang, revel
beedb mysql的orm

how to run

# install revel:
go get github.com/robfig/revel
go build -o bin/revel github.com/robfig/revel/cmd

# goalng package needs 
go get github.com/astaxie/beedb
go get github.com/go-sql-driver/mysql
go get github.com/hoise/redis

ubuntu 下安装依赖包

sudo apt-get install mysql-server

mysql数据库相关的操作使用rails 的migration

需要安装ruby, activerecord gem

rake db:create
rake db:migrate

手动创建数据库

 CREATE DATABASE `webchat_dev` /*!40100 DEFAULT CHARACTER SET utf8 */;
 USE webchat_dev;
 source db/db.sql;

使用redis存储数据相关结构

  • save message to list

    key: room:roomkey
    format: type|username|text|time

  • room 最近用户存储在集合中

    room:test:users

  • user 信息 Hash

    key 是: user:id value 是: name, avatar, id

rooms list

chat room

webchat's People

Contributors

defp avatar

Watchers

 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.