Skip to content

Commit

Permalink
feat(cmd): add log
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Jul 14, 2023
1 parent a0dee51 commit 8adbd5b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/lightcable/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ func main() {
}

server := lightcable.New(lightcable.DefaultConfig)
server.OnRoomReady(func(room string) {
log.Printf("Room Ready: %s", room)
})
server.OnRoomClose(func(room string) {
log.Printf("Room Close: %s", room)
})
server.OnConnReady(func(c *lightcable.Client) {
log.Printf("Room: %s, Conn Ready: %s", c.Room, c.Name)
})
server.OnConnClose(func(c *lightcable.Client) {
log.Printf("Room: %s, Conn Close: %s", c.Room, c.Name)
})
server.OnMessage(func(m *lightcable.Message) {
log.Printf("Room: %s, Conn: %s, Data: %s, Code: %d", m.Room, m.Name, m.Data, m.Code)
})
go server.Run(context.Background())

log.Println("Listen address:", *address)
Expand Down

0 comments on commit 8adbd5b

Please sign in to comment.