ethan-well / go-chat Goto Github PK
View Code? Open in Web Editor NEWGolang 高并发聊天程序/go chat room
Golang 高并发聊天程序/go chat room
点对点聊天,可以使用udp打洞的形式,将消息记录不经过server吗
感谢分享
并发操作map都不加锁规避下闪退的问题,而且所有在线用户都放在一个 map里面,一个群发消息过来就循环发送,这个时间有考虑么
为啥点对点不能连续发消息?A用户发了一次消息B用户收到了,然后A用户再发消息B用户都不到了,一定要B用户发一条消息后A用户再发消息B用户才能收到,就是不能连续发消息?
Reproduction Steps:
Attempt to send a message to a user who is not logged into the application/program.
Notice that an error occurs during the message sending process.
Fix :
//clientConn.go
func (cc ClientConn) IsLoggedInUser(userName string) (bool){
for _, connInfo := range ClientConnsMap{
if userName == connInfo.UserName {
return true
}
}
return false
}
///pointToPointMessageProcess.go
isLoggedInUser := clientConn.IsLoggedInUser(pointToPointMessage.TargetUserName)
if !isExist {
err = fmt.Errorf("not logined user")
return
}
Thanks for your open source golang project. I learned a lot about making chat program by golang.
还有客户端不能断线自动重连?
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.