Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeGRPCSendChatReq(_ context.Context, request interface{}) (interface{}, error)
- func EncodeGRPCSendChatRes(_ context.Context, response interface{}) (interface{}, error)
- func EndpointInstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeGRPCHandler(endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.GameServiceServer
- func MakeSendChatEndpoint(s GameService) endpoint.Endpoint
- func NewAirfone(stream pb.GameService_StreamServer, logger log.Logger) (af airfone)
- func NewUserCenter(serviceName string, etcdAddr []string, retryMax int, ...) (uc *userCenter, err error)
- type Endpoints
- type ErrCode
- type GameService
- type Middleware
Constants ¶
View Source
const ( CmdEnter uint32 = 10000 //登入 CmdSendChat uint32 = 10017 //发聊天消息 )
View Source
const (
InformPlayerSendChat uint32 = 20019 //通知玩家发聊天消息
)
View Source
const (
ReportClientOffline uint32 = 40001
)
Variables ¶
View Source
var ( ErrorInvalidToken = errors.New("invalid token") ErrorNotOnTable = errors.New("not on table") ErrorBadRequest = errors.New("seat not empty") ErrorBadFrame = errors.New("bad frame") ErrorInvalidProtocol = errors.New("invalid protocol") ErrorClientDisconnected = errors.New("client end disconnected") )
Functions ¶
func DecodeGRPCSendChatReq ¶
sendChat
func EncodeGRPCSendChatRes ¶
func EndpointInstrumentingMiddleware ¶
func EndpointInstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
func EndpointLoggingMiddleware ¶
func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
EndpointLoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.
func MakeGRPCHandler ¶
func MakeGRPCHandler(endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.GameServiceServer
func MakeSendChatEndpoint ¶
func MakeSendChatEndpoint(s GameService) endpoint.Endpoint
func NewAirfone ¶
func NewAirfone(stream pb.GameService_StreamServer, logger log.Logger) (af airfone)
Types ¶
type GameService ¶
type GameService interface {
SendChat(ctx context.Context, id gamer.UserID, mid int32, msg string) (err error)
}
func NewGameService ¶
func NewGameService(fir gamer.RoomOptions, uc *userCenter, logger log.Logger) GameService
type Middleware ¶
type Middleware func(GameService) GameService
func ServiceInstrumentingMiddleware ¶
func ServiceInstrumentingMiddleware(requestCount metrics.Counter, requestLatency metrics.Histogram) Middleware
func ServiceLoggingMiddleware ¶
func ServiceLoggingMiddleware(logger log.Logger) Middleware
Click to show internal directories.
Click to hide internal directories.