github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/abci/server/server.go (about)

     1  /*
     2  Package server is used to start a new ABCI server.
     3  
     4  It contains two server implementation:
     5   * gRPC server
     6   * socket server
     7  
     8  */
     9  package server
    10  
    11  import (
    12  	"fmt"
    13  
    14  	"github.com/tendermint/tendermint/abci/types"
    15  	"github.com/tendermint/tendermint/libs/service"
    16  )
    17  
    18  func NewServer(protoAddr, transport string, app types.Application) (service.Service, error) {
    19  	var s service.Service
    20  	var err error
    21  	switch transport {
    22  	case "socket":
    23  		s = NewSocketServer(protoAddr, app)
    24  	case "grpc":
    25  		s = NewGRPCServer(protoAddr, types.NewGRPCApplication(app))
    26  	default:
    27  		err = fmt.Errorf("unknown server type %s", transport)
    28  	}
    29  	return s, err
    30  }