feat:完善项目

This commit is contained in:
henry
2021-11-08 15:52:46 +08:00
parent 1502076841
commit 1cc95fb5ca
16 changed files with 154 additions and 64 deletions

View File

@ -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]