All Projects → firejq → MultiClientWebChat

firejq / MultiClientWebChat

Licence: AGPL-3.0 license
基于 Spring Websocket 和心跳保活重连的多人网页聊天室

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to MultiClientWebChat

ansible-role-pacemaker
Ansible role to deploy Pacemaker HA clusters
Stars: ✭ 19 (-38.71%)
Mutual labels:  heartbeat
measure-stress-hrv-android
Get stress measurement results in your Android app using Welltory heart rate variability algorithms
Stars: ✭ 24 (-22.58%)
Mutual labels:  heartbeat
spring-web-socket-chat
Sample chat application with spring web socket, Sock Js and Stomp protocol
Stars: ✭ 21 (-32.26%)
Mutual labels:  spring-websocket
go websocket
golang搭建的websocket服务器
Stars: ✭ 24 (-22.58%)
Mutual labels:  heartbeat
devheart
Listen to Tux's heartbeat with this awesome Linux Kernel Module ❤️
Stars: ✭ 58 (+87.1%)
Mutual labels:  heartbeat
Nettychat
基于Netty+TCP+Protobuf实现的Android IM库,包含Protobuf序列化、TCP拆包与粘包、长连接握手认证、心跳机制、断线重连机制、消息重发机制、读写超时机制、离线消息、线程池等功能。
Stars: ✭ 1,979 (+6283.87%)
Mutual labels:  heartbeat
Beats
🐠 Beats - Lightweight shippers for Elasticsearch & Logstash
Stars: ✭ 10,522 (+33841.94%)
Mutual labels:  heartbeat
Cim
📲cim(cross IM) 适用于开发者的分布式即时通讯系统
Stars: ✭ 8,109 (+26058.06%)
Mutual labels:  heartbeat
fire-im
分布式IM服务,参考https://github.com/crossoverJie/cim 实现
Stars: ✭ 17 (-45.16%)
Mutual labels:  heartbeat
Hangfire.Heartbeat
Server monitoring plugin for Hangfire.
Stars: ✭ 71 (+129.03%)
Mutual labels:  heartbeat

MultiClientWebChat

基于 Spring Websocket 和心跳保活重连的多人网页聊天室

Only for practice

Feature and Achieve

Schedule

  • Multiple client chat
  • Client reconnecting mechanism
  • Client keep alive and reconnect using heartbeat
  • MessageQueue broke

Multiple client chat

  • 当一个客户端打开,即建立一个与服务器的websocket连接,同时服务端将此 sessionId 加入到消息队列中
  • 当一个客户端发送信息时,服务器接收信息并将其广播给连接的所有客户端
  • 当一个客户端断开时,服务器将其从消息队列中移除

Client reconnecting mechanism

  • 若 client-server 通信发生中断,触发客户端onclose event,主动重连

Client keep alive and reconnect using heartbeat

存在这样的情况:

  • 超过一定的时间客户端和服务器之间没有发生任何消息传输,导致websocket连接自动断开。

  • websocket通信出错,但无法触发客户端 close 事件,导致客户端无法获知中断状况,编写在onclose中的重连逻辑也因此失效。

解决方法:设计客户端心跳保活+重连机制

客户端设置计时器,每次收到任何信息都将计时器归零,当计时器到时,发送一个心跳包(作用①保活,②检测连接状态),若服务器返回响应,则将计时器归零后重新启动;若服务器响应时间超时(认定为没有响应),则说明连接中断,执行重连逻辑。

MessageQueue broke

  • 使用专用消息队列作为消息中间层
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].