msg= string -> Message
This commit is contained in:
parent
2289aa31fd
commit
f4462e5df1
1 changed files with 7 additions and 6 deletions
|
@ -17,12 +17,12 @@ type Message struct {
|
|||
|
||||
type Event struct {
|
||||
Message chan Message
|
||||
NewClient chan chan string
|
||||
ClosedClient chan chan string
|
||||
TotalClients map[chan string]bool
|
||||
NewClient chan chan Message
|
||||
ClosedClient chan chan Message
|
||||
TotalClients map[chan Message]bool
|
||||
}
|
||||
|
||||
type ClientChan chan string
|
||||
type ClientChan chan Message
|
||||
|
||||
func main() {
|
||||
|
||||
|
@ -133,8 +133,9 @@ func (e *Event) Broadcast() {
|
|||
id++
|
||||
message.Id = strconv.Itoa(id)
|
||||
for client := range e.TotalClients {
|
||||
msg, _ := json.Marshal(message)
|
||||
client <- string(msg)
|
||||
// msg, _ := json.Marshal(message)
|
||||
// client <- string(msg)
|
||||
client <- message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue