Documentation ¶
Index ¶
- type Candidate
- type Client
- type ClientOption
- type Credentials
- type Message
- type SignalingClient
- func (c *SignalingClient) Close() error
- func (c *SignalingClient) Publish(ctx context.Context, message *Message) error
- func (c *SignalingClient) Subscribe(ctx context.Context, topic string, handler func(*Message) error) error
- func (c *SignalingClient) Unsubscribe(ctx context.Context, topic string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Publish 将消息发布到指定的主题 Publish(ctx context.Context, message *Message) error // Subscribe 订阅指定主题的消息,并提供一个处理函数来处理收到的消息 Subscribe(ctx context.Context, topic string, handler func(*Message) error) error // Unsubscribe 取消订阅指定主题的消息 Unsubscribe(ctx context.Context, topic string) error // Close 关闭客户端连接 Close() error }
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
type Credentials ¶
type Credentials = signaling.Credentials
type SignalingClient ¶
type SignalingClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(addr string, opts ...ClientOption) (*SignalingClient, error)
func NewClientWithDialer ¶
func NewClientWithDialer(bufDialer func(context.Context, string) (net.Conn, error), opts ...ClientOption) (*SignalingClient, error)
NewClientWithDialer 本地调试使用 bufDialer 来创建一个 gRPC 客户端
func (*SignalingClient) Close ¶
func (c *SignalingClient) Close() error
func (*SignalingClient) Publish ¶
func (c *SignalingClient) Publish(ctx context.Context, message *Message) error
func (*SignalingClient) Unsubscribe ¶
func (c *SignalingClient) Unsubscribe(ctx context.Context, topic string) error
Click to show internal directories.
Click to hide internal directories.