Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ func (client *Client) Emit(message string, args ...interface{}) (err error) {
return client.send(args)
}

func (client *Client) Close() error {
return client.conn.Close()
}

func (client *Client) Connected() bool {
switch client.conn.getState() {
case stateNormal, stateUpgrading:
return true
case stateUnknow, stateClosed:
fallthrough
default:
return false
}
}

func (client *Client) sendConnect() error {
packet := packet{
Type: _CONNECT,
Expand Down