im_server

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunRpcServer

func RunRpcServer(options *rpc.ServerOptions, gate gate.Gateway, subscribe subscription.Subscribe) error

Types

type ConnectionMetrics added in v1.2.0

type ConnectionMetrics struct {
	ConnectionCounter metrics.Counter
	LoginCounter      metrics.Counter
	OnlineTempCounter metrics.Counter
	MaxOnline         metrics.Gauge
	AliveMeter        metrics.Meter
	AliveLoggedMeter  metrics.Meter

	AliveTempH   metrics.Histogram
	AliveLoggedH metrics.Histogram
}

func NewConnectionMetrics added in v1.2.0

func NewConnectionMetrics() *ConnectionMetrics

func (*ConnectionMetrics) Connected added in v1.2.0

func (c *ConnectionMetrics) Connected()

func (*ConnectionMetrics) Exit added in v1.2.0

func (c *ConnectionMetrics) Exit(info gate.Info)

func (*ConnectionMetrics) Login added in v1.2.0

func (c *ConnectionMetrics) Login()

type GatewayMetrics added in v1.2.0

type GatewayMetrics struct {
	ServerId     string
	Addr         string
	Port         int
	StartAt      time.Time
	RunningHours float64
	Message      *MessageMetrics
	Conn         *ConnectionMetrics
}

type GatewayServer

type GatewayServer struct {
	*gateway.Impl
	// contains filtered or unexported fields
}

func NewServer

func NewServer(id string, addr string, port int) (*GatewayServer, error)

func (*GatewayServer) EnqueueMessage added in v1.1.0

func (c *GatewayServer) EnqueueMessage(id gate.ID, msg *messages.GlideMessage) error

func (*GatewayServer) ExitClient added in v1.2.0

func (c *GatewayServer) ExitClient(id gate.ID) error

func (*GatewayServer) GetState added in v1.1.0

func (c *GatewayServer) GetState() GatewayMetrics

func (*GatewayServer) HandleConnection

func (c *GatewayServer) HandleConnection(conn conn.Connection) gate.ID

HandleConnection 当一个用户连接建立后, 由该方法创建 Client 实例 Client 并管理该连接, 返回该由连接创建客户端的标识 id 返回的标识 id 是一个临时 id, 后续连接认证后会改变

func (*GatewayServer) Run

func (c *GatewayServer) Run() error

func (*GatewayServer) SetClientID added in v1.2.0

func (c *GatewayServer) SetClientID(oldID, newID gate.ID) error

func (*GatewayServer) SetMessageHandler

func (c *GatewayServer) SetMessageHandler(h gate.MessageHandler)

type MessageMetrics added in v1.2.0

type MessageMetrics struct {
	MessageInMeter  metrics.Meter
	MessageOutMeter metrics.Meter
	OutCounter      metrics.Counter
	FailsCounter    metrics.Counter
	InCounter       metrics.Counter
	InHistogram     metrics.Histogram
	OutHistogram    metrics.Histogram
}

func NewMessageMetrics added in v1.2.0

func NewMessageMetrics() *MessageMetrics

func (*MessageMetrics) In added in v1.2.0

func (m *MessageMetrics) In()

func (*MessageMetrics) Out added in v1.2.0

func (m *MessageMetrics) Out()

func (*MessageMetrics) OutFailed added in v1.2.0

func (m *MessageMetrics) OutFailed()

type RpcServer

type RpcServer struct {
	// contains filtered or unexported fields
}

func (*RpcServer) CreateChannel added in v1.1.0

func (r *RpcServer) CreateChannel(ctx context.Context, request *proto.CreateChannelRequest, response *proto.Response) error

func (*RpcServer) EnqueueMessage

func (r *RpcServer) EnqueueMessage(ctx context.Context, request *proto.EnqueueMessageRequest, response *proto.Response) error

func (*RpcServer) ExitClient

func (r *RpcServer) ExitClient(ctx context.Context, request *proto.ExitClientRequest, response *proto.Response) error

func (*RpcServer) IsOnline

func (r *RpcServer) IsOnline(ctx context.Context, request *proto.IsOnlineRequest, response *proto.IsOnlineResponse) error

func (*RpcServer) Publish added in v1.1.0

func (r *RpcServer) Publish(ctx context.Context, request *proto.PublishRequest, response *proto.Response) error

func (*RpcServer) RemoveChannel added in v1.1.0

func (r *RpcServer) RemoveChannel(ctx context.Context, request *proto.RemoveChannelRequest, response *proto.Response) error

func (*RpcServer) SetClientID

func (r *RpcServer) SetClientID(ctx context.Context, request *proto.SetIDRequest, response *proto.Response) error

func (*RpcServer) Subscribe added in v1.1.0

func (r *RpcServer) Subscribe(ctx context.Context, request *proto.SubscribeRequest, response *proto.Response) error

func (*RpcServer) UnSubscribe added in v1.1.0

func (r *RpcServer) UnSubscribe(ctx context.Context, request *proto.UnsubscribeRequest, response *proto.Response) error

func (*RpcServer) UpdateChannel added in v1.1.0

func (r *RpcServer) UpdateChannel(ctx context.Context, request *proto.UpdateChannelRequest, response *proto.Response) error

func (*RpcServer) UpdateSubscriber added in v1.1.0

func (r *RpcServer) UpdateSubscriber(ctx context.Context, request *proto.UpdateSubscriberRequest, response *proto.Response) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL