Git Product home page Git Product logo

wechat-chat's Introduction

wechat-chat

本项目使用 Gorilla WebSocket 作为聊天室后台 , Gorilla WebSocket 基于go语言开发,提供的demo实例中有聊天室源码,不需要任何修改就能生成一个聊天室项目(包含后台+web前台)

demo:
http://121.42.51.70:8080

##一、聊天室服务搭建步骤:
如果不想搭建服务器,可以跳过这个步骤,直接使用我的服务

  1. 安装 golang , 安装1.6以上版本,低版本问题较多。注:下载golang需要翻墙

  2. 安装Gorilla WebSocket模块

    go get github.com/gorilla/websocket
    
  3. 启动聊天室

    $ go get github.com/gorilla/websocket    
    $ cd `go list -f '{{.Dir}}' github.com/gorilla/   websocket/examples/chat`
    $ go run *.go  
    
  4. web客户端
    访问:http://ip:8080

##二、微信小程序客户端

  1. git clone https://github.com/ericzyh/wechat-chat.git

  2. 使用微信web开发者工具导入项目

  3. 修改服务地址 wechat-chat/utils/websockets.js 行1

##三、小程序开发问题 (Q&A)

  1. 如何通过js获取到某个组件? (发送消息后,清空输入框)
    A:

  2. text存英文超过屏幕宽度后,会出现横向滚动条?
    A: 和css一样加上样式:word-break:break-all;

  3. 有没有办法在view里通过js动态加入view?
    A:

##四、todo

  1. 发送消息后,清空输入框
  2. 名字可点击,实现1v1通讯
  3. 加入聊天间

wechat-chat's People

Contributors

ericzyh avatar

Watchers

James Cloos 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.