Skip to content

Commit a3564c4

Browse files
authored
fix example cases (#50)
1 parent d37fa50 commit a3564c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

internal/examples/tcp/broadcast/client/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func senderClient() {
5959
log.Error(err)
6060
return
6161
}
62-
log.Infof("sender | recv ack | %s", msg.Data)
62+
log.Infof("sender | recv ack | %s", msg.Data())
6363
}
6464
}()
6565
}
@@ -78,7 +78,7 @@ func readerClient(id int) {
7878
log.Error(err)
7979
return
8080
}
81-
log.Debugf("reader %03d | recv broadcast | %s", id, msg.Data)
81+
log.Debugf("reader %03d | recv broadcast | %s", id, msg.Data())
8282
}
8383
}()
8484
}

internal/examples/tcp/broadcast/server/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func main() {
4949
s.Use(fixture.RecoverMiddleware(log), logMiddleware)
5050

5151
s.AddRoute(common.MsgIdBroadCastReq, func(ctx easytcp.Context) {
52-
reqData := ctx.Request().Data
52+
reqData := ctx.Request().Data()
5353

5454
// broadcasting to other sessions
5555
currentSession := ctx.Session()
@@ -89,7 +89,7 @@ func main() {
8989

9090
func logMiddleware(next easytcp.HandlerFunc) easytcp.HandlerFunc {
9191
return func(ctx easytcp.Context) {
92-
log.Infof("recv request | %s", ctx.Request().Data)
92+
log.Infof("recv request | %s", ctx.Request().Data())
9393
defer func() {
9494
var respMsg = ctx.Response()
9595
log.Infof("send response |sessId: %d; id: %d; size: %d; data: %s", ctx.Session().ID(), respMsg.ID(), len(respMsg.Data()), respMsg.Data())

0 commit comments

Comments
 (0)