Skip to content

Commit 0699e93

Browse files
committed
refactor: rename hub parameter in send and wsHandler functions for clarity
1 parent 9535905 commit 0699e93

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: conn.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,26 @@ func (l PLogger) Info(args ...interface{}) {
211211
send(l.hub, map[string]string{uploadStatusStr: "Busy", "Msg": output})
212212
}
213213

214-
func send(hub *hub, args map[string]string) {
214+
func send(h *hub, args map[string]string) {
215215
mapB, _ := json.Marshal(args)
216-
hub.broadcastSys <- mapB
216+
h.broadcastSys <- mapB
217217
}
218218

219-
func wsHandler(hub *hub) *WsServer {
219+
func wsHandler(h *hub) *WsServer {
220220
server, err := socketio.NewServer(nil)
221221
if err != nil {
222222
log.Fatal(err)
223223
}
224224

225225
server.On("connection", func(so socketio.Socket) {
226226
c := &connection{send: make(chan []byte, 256*10), ws: so}
227-
hub.register <- c
227+
h.register <- c
228228
so.On("command", func(message string) {
229-
hub.broadcast <- []byte(message)
229+
h.broadcast <- []byte(message)
230230
})
231231

232232
so.On("disconnection", func() {
233-
hub.unregister <- c
233+
h.unregister <- c
234234
})
235235
go c.writer()
236236
})

0 commit comments

Comments
 (0)