code: func NewClient(backend Backend, conn transport.Conn) *Client {
  	// create client
  	c := &Client{
  		state:   clientConnecting,
  		backend: backend,
  		conn:    conn,
  		done:    make(chan struct{}),
  	}
  
  	// start processor
  	c.tomb.Go(c.processor)
  
  	// run cleanup goroutine
  	go func() {
  		// wait for death and cleanup
  		_ = c.tomb.Wait()
  		c.cleanup()
  
  		// close channel
  		close(c.done)
  	}()
  
  	return c
  }
docs: // NewClient takes over a connection and returns a Client.