Code Monkey home page Code Monkey logo

chat-api's Introduction

分布式聊天系统

本系统支持 NSQ 和 AMQP 两种消费协议,可以通过修改 CONSUMER_ENGINE 环境变量进行切换,推荐使用 AMQP

连接

ws://127.0.0.1:9501/?token=xxx

协议

查看所有用户列表

{"protocal":"user.list","data":"Hello World"}

向对方用户发送消息

{"protocal":"send.message","data":{"id":2,"message":"Hello World."}}

测试

启动两个服务,分别使用端口 9501 和 9502

让客户端A使用以下连接,连接 9501 端口

ws://127.0.0.1:9501/?token=1

让客户端B使用以下连接,连接 9502 端口

ws://127.0.0.1:9502/?token=2

使用客户端 A 发送协议

{"protocal":"send.message","data":{"id":2,"message":"Hello World."}}

客户端 B 即可收到消息

chat-api's People

Contributors

limingxinleo avatar dependabot[bot] avatar missxiaolin avatar dependabot-preview[bot] 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.