github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/srpc.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package protocol
     4  
     5  // SRPCHandler is any object to be sRPC service handler.
     6  type SRPCHandler interface {
     7  	// ServeSRPC method is sRPC handler of the service with Syllab codec data in the payload.
     8  	ServeSRPC(st Stream) (err Error)
     9  	// DoSRPC(req interface{}) (res Interface{}, err Error) Due to specific sign for each service, we can't standard it here.
    10  
    11  	// ServeSRPCDirect use to call a service without need to open any stream.
    12  	// It can also use when service request data is smaller than network MTU.
    13  	// Or use for time sensitive data like audio and video that streams shape in app layer
    14  	ServeSRPCDirect(conn Connection, request []byte) (response []byte, err Error)
    15  }