service

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrComet commet error.
	ErrComet = errors.New("comet rpc is not available")
	// ErrCometFull comet chan full.
	ErrCometFull = errors.New("comet proto chan full")
	// ErrRoomFull room chan full.
	ErrRoomFull = errors.New("room proto chan full")
)

Functions

This section is empty.

Types

type Comet

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

Comet is a broadcast comet.

func NewComet

func NewComet(data *naming.Instance, conf *conf.Config, options CometOptions) (*Comet, error)

NewComet new a comet.

func (*Comet) Broadcast

func (c *Comet) Broadcast(arg *client.BroadcastReq) (err error)

Broadcast broadcast a message.

func (*Comet) BroadcastRoom

func (c *Comet) BroadcastRoom(arg *client.BroadcastRoomReq) (err error)

BroadcastRoom broadcast a room message.

func (*Comet) Close

func (c *Comet) Close() (err error)

Close close the resouces.

func (*Comet) Push

func (c *Comet) Push(arg *client.PushMsgReq) (err error)

Push push a user message.

type CometOptions

type CometOptions struct {
	RoutineSize uint64
	RoutineChan uint64
}

CometOptions comet options.

type Room

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

Room room.

func NewRoom

func NewRoom(s *Service, id string, options RoomOptions) (r *Room)

NewRoom new a room struct, store channel room info.

func (*Room) Push

func (r *Room) Push(op int32, msg []byte, contentType int32) (err error)

Push push msg to the room, if chan full discard it.

type RoomOptions

type RoomOptions struct {
	BatchNum   int
	SignalTime time.Duration
}

RoomOptions room options.

type Service

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

Service is a service.

func New

func New(c *conf.Config) *Service

New new a service and return.

func (*Service) Close

func (s *Service) Close() error

Close close the resources.

Jump to

Keyboard shortcuts

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