-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
package client | ||
|
||
// session represents a Session which is a stateful interaction between a Client and a Server. | ||
import "github.com/yosssi/gmq/mqtt/packet" | ||
|
||
// session represents a Session which is a stateful interaction | ||
// between a Client and a Server. | ||
type session struct { | ||
// cleanSession is the Clean Session. | ||
cleanSession bool | ||
// clientID is the Client Identifier. | ||
clientID []byte | ||
|
||
// sendingPackets contains the pairs of the Packet Identifier | ||
// and the Packet. | ||
sendingPackets map[uint16]packet.Packet | ||
} | ||
|
||
// newSession creates and returns a Session. | ||
func newSession(cleanSession bool, clientID []byte) *session { | ||
return &session{ | ||
cleanSession: cleanSession, | ||
clientID: clientID, | ||
sendingPackets: make(map[uint16]packet.Packet), | ||
} | ||
} |