func (session *Session) Close(reason string) {
	if session.closed {
		return
	}

	session.closed = true

	session.sending.Wait()

	if session.transport != nil {
		session.transport.Shutdown()
	}

	session.debug("Session closed. Reason: ", reason)

	session.emit(DisconnectEvent{session.id, reason})

	close(session.events)
}
// Close changes the session state and closes the channels
Close changes the session state and closes the channels
// Close changes the session state and closes the channels
func (session *Session) Close(reason string) {
	if session.closed {
		return
	}
	session.closed = true
	session.sending.Wait()
	if session.transport != nil {
		session.transport.Shutdown()
	}
	session.debug("Session closed. Reason: ", reason)
	session.emit(DisconnectEvent{session.id, reason})
	close(session.events)
}
func ( session * Session ) Close ( reason string ) { if session . closed { return } session . closed = true session . sending . Wait ( ) if session . transport != nil { session . transport . Shutdown ( ) } session . debug ( " " , reason ) session . emit ( DisconnectEvent { session . id , reason } ) close ( session . events ) }
Close changes the session state and closes the channels
Close changes the session state and closes the channels