feat:完善项目
This commit is contained in:
@ -40,7 +40,12 @@ func (this *Hub) Run() {
|
||||
}
|
||||
case message := <-this.broadcast:
|
||||
for _, client := range this.clients {
|
||||
client.send <- message.ToBytes()
|
||||
select {
|
||||
case client.send <- message.ToBytes():
|
||||
default:
|
||||
close(client.send)
|
||||
delete(this.clients, client.ID)
|
||||
}
|
||||
}
|
||||
case iMsg := <-this.emit:
|
||||
client, has := this.clients[iMsg.ID]
|
||||
|
Reference in New Issue
Block a user