Documentation
¶
Index ¶
- Variables
- type Option
- func BodyCodec(c string) Option
- func ContextAge(n time.Duration) Option
- func CountTime(c bool) Option
- func DialTimeout(n time.Duration) Option
- func GlobalLeftPlugin(plugin ...drpc.Plugin) Option
- func HeartbeatTime(t time.Duration) Option
- func LocalIP(addr string) Option
- func Network(net string) Option
- func PrintDetail(c bool) Option
- func ProtoFunc(pf proto.ProtoFunc) Option
- func Registry(r registry.Registry) Option
- func RetryTimes(n int) Option
- func Selector(s selector.Selector) Option
- func SessionAge(n time.Duration) Option
- func SlowCometDuration(n time.Duration) Option
- func TlsConfig(config *tls.Config) Option
- func TlsFile(tlsCertFile string, tlsKeyFile string) Option
- type Options
- type RpcClient
- func (that *RpcClient) AsyncCall(serviceMethod string, arg interface{}, result interface{}, ...) drpc.CallCmd
- func (that *RpcClient) Call(serviceMethod string, args interface{}, result interface{}, ...) drpc.CallCmd
- func (that *RpcClient) Close()
- func (that *RpcClient) Endpoint() drpc.Endpoint
- func (that *RpcClient) Options() Options
- func (that *RpcClient) Push(serviceMethod string, arg interface{}, setting ...message.MsgSetting) *drpc.Status
- func (that *RpcClient) RoutePush(ctrlStruct interface{}, plugin ...drpc.Plugin) []string
- func (that *RpcClient) RoutePushFunc(pushHandleFunc interface{}, plugin ...drpc.Plugin) string
- func (that *RpcClient) SubRoute(pathPrefix string, plugin ...drpc.Plugin) *drpc.SubRouter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultBodyCodec 默认的消息编码 DefaultBodyCodec = "json" // DefaultSessionAge 默认session会话生命周期 DefaultSessionAge = time.Duration(0) // DefaultContextAge 默认单次请求生命周期 DefaultContextAge = time.Duration(0) // DefaultDialTimeout 作为客户端角色时,请求服务端的超时时间 DefaultDialTimeout = time.Second * 5 // DefaultSlowCometDuration 慢处理定义时间 DefaultSlowCometDuration = time.Duration(0) // DefaultRetryTimes 默认重试次数 DefaultRetryTimes = 2 // RerClientClosed 客户端已关闭错误信息 RerClientClosed = drpc.NewStatus(100, "client is closed", "") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
func ContextAge ¶
func DialTimeout ¶
func PrintDetail ¶
func SessionAge ¶
func SlowCometDuration ¶
type Options ¶
type Options struct {
Context context.Context // 上下文
Network string // 网络类型
LocalIP string // 本地网络
TlsCertFile string
TlsKeyFile string
TLSConfig *tls.Config
ProtoFunc proto.ProtoFunc
SessionAge time.Duration
ContextAge time.Duration
DialTimeout time.Duration
SlowCometDuration time.Duration
BodyCodec string
PrintDetail bool
CountTime bool
HeartbeatTime time.Duration
Registry registry.Registry
Selector selector.Selector
RetryTimes int
GlobalLeftPlugin []drpc.Plugin
}
func (*Options) EndpointConfig ¶
func (that *Options) EndpointConfig() drpc.EndpointConfig
type RpcClient ¶
type RpcClient struct {
// contains filtered or unexported fields
}
RpcClient rpc客户端结构体
func NewRpcClient ¶
NewRpcClient 创建rpc客户端
func (*RpcClient) AsyncCall ¶
func (that *RpcClient) AsyncCall(serviceMethod string, arg interface{}, result interface{}, callCmdChan chan<- drpc.CallCmd, setting ...message.MsgSetting) drpc.CallCmd
AsyncCall 异步请求
func (*RpcClient) Call ¶
func (that *RpcClient) Call(serviceMethod string, args interface{}, result interface{}, setting ...message.MsgSetting) drpc.CallCmd
Call 请求服务端
func (*RpcClient) Push ¶
func (that *RpcClient) Push(serviceMethod string, arg interface{}, setting ...message.MsgSetting) *drpc.Status
Push 发送push消息
func (*RpcClient) RoutePushFunc ¶
RoutePushFunc 使用函数注册PUSH处理程序,并且返回地址
Click to show internal directories.
Click to hide internal directories.