Skip to content

Commit

Permalink
feat: 增加OnSessionCreated回调
Browse files Browse the repository at this point in the history
  • Loading branch information
chenqinghe committed Oct 18, 2022
1 parent 7bb4a32 commit 8fc1ade
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type NewClientOptions struct {
KeepalivePeriod time.Duration
HeartbeatPacketFactory func() Packet
OnConnected func(c Conn) error
OnSessionCreated func(s *Session)
OnClosed func(session *Session)
NeedReconnect bool
ReconnectPolicy ReconnectPolicy
Expand All @@ -40,6 +41,7 @@ func NewClient(codec Codec, handler Handler, opts *NewClientOptions) *Client {
closed: make(chan struct{}),
}
cli.mgr = NewManager(handler, &NewManagerOptions{
OnSessionCreated: opts.OnSessionCreated,
AfterSessionClosed: func(s *Session) {
cli.reconnect(s)
},
Expand Down

0 comments on commit 8fc1ade

Please sign in to comment.