code: func (ed *Dispatcher) HandleDisconnectEvent(e esdispatcher.Event) {
  	evt := e.(*DisconnectEvent)
  
  	if ed.connection == nil {
  		evt.Errch <- errors.New("connection already closed")
  		return
  	}
  
  	logger.Debug("Closing connection due to disconnect event...")
  
  	ed.connection.Close()
  	ed.connection = nil
  	ed.setConnectedPeer(nil)
  
  	evt.Errch <- nil
  }
docs: // HandleDisconnectEvent disconnects from the event server