im-tools / go-im Goto Github PK
View Code? Open in Web Editor NEW旧版本停止维护⚠️ 新版本地址:https://github.com/IM-Tools/Im-Services
Home Page: http://chat.pltrue.top/login
License: Apache License 2.0
旧版本停止维护⚠️ 新版本地址:https://github.com/IM-Tools/Im-Services
Home Page: http://chat.pltrue.top/login
License: Apache License 2.0
manager.SetClientInfo(conn) // 设置客户端信息
manager.LaunchOnlineMsg(conn.ID) // 用户在线下发通知
node.SetUserServiceNode(conn.ID) // 设置用户节点
// 需要加一句设置 Status = 1 的状态
我记得以前有个类似项目的IM也是网页版的 他们的群就是有新消息接入的百度的 语音转换把文字在线转换播放 这样就不用一直到打开IM界面看 群有文字聊天新消息就会自动播放语音
我记得以前有个类似项目的IM也是网页版的 他们的群就是有新消息接入的百度的 语音转换把文字在线转换播放 这样就不用一直到打开IM界面看 群有文字聊天新消息就会自动播放语音
// 用户被挤下线
func CrowdedOffline(user_id int64) {
manager := new(ImClientManager); // 这个写有bug呀,这个是明显错误哦
if conn, ok := manager.ImClientMap[user_id]; ok {
jsonMessage, _ := json.Marshal(&ImOnlineMsg{Code: CrowdedOk, Msg: "账号已在别处登录", ID: conn.ID, ChannelType: 3})
//conn.Send <- jsonMessage
conn.Socket.WriteMessage(websocket.TextMessage, jsonMessage)
conn.Socket.Close()
close(conn.Send)
delete(manager.ImClientMap, conn.ID)
}
}
要是有一个简易的后台就好啦,哈哈
每一个链接用户都有一个专属mq队列和一个mq 消费,如果同时有上万个用户在线,mq的性能瓶颈将是该系统性能的关键点。
建议把部署使用步骤直接写在readme里
消息好像没有ack的实现,如果有就完美啦
可以分表,预热db
当一个conn一段时间后没有消息,则视为无效conn,应当delete掉
1.检测当前的chatUid不是消息的fromid,则本地推送,否则直接显示
2.在1的基础上,要实现一个点击pushNotification跳转到chatpage的过程,这个是一个deeplink类似的过程
3.用户离线的时候,应该要用 android/ios 的pushService,且需要消息入MQ
负载均衡的port 和 ip都是一样的,这个无法做到负载均衡
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.