Versions in this module Expand all Collapse all v1 v1.1.2 Apr 3, 2024 v1.1.1 Apr 3, 2024 Changes in this version + const NoRoom + func GenChannelIdByFriend(userId, friendId int64) string + func GenChannelIdByGroup(groupName string) string + func JoinChannelIds(uid string, channelIds ...string) + func Run(svcCtx *svc.ServiceContext) error + func SendMessageToChannelIds(uid string, msg string, tp uint8, channelIds ...string) + func SendMessageToUid(uid string, toUId uint64, msg string, tp uint8) + func SendMessageToUids(uid string, msg string, tp uint8, toUIds ...uint64) + type Bucket struct + func NewBucket(bucketOptions BucketOptions) (b *Bucket) + func (b *Bucket) BroadcastRoom(pushRoomMsgReq *pb.PushRoomMsgRequest) + func (b *Bucket) Channel(userId int64) (ch *Channel) + func (b *Bucket) DeleteChannel(ch *Channel) + func (b *Bucket) PushRoom(ch chan *pb.PushRoomMsgRequest) + func (b *Bucket) Put(userId int64, roomId int64, ch *Channel) (err error) + func (b *Bucket) Room(rid int64) (room *Room) + type BucketOptions struct + ChannelSize int + RoomSize int + RoutineAmount uint64 + RoutineSize int + type Channel struct + Next *Channel + Prev *Channel + Room *Room + func NewChannel(size int) (c *Channel) + func (ch *Channel) Push(msg *pb.Msg) (err error) + type Connect struct + ServerId string + func New() *Connect + type Room struct + Id int64 + OnlineCount int + func NewRoom(roomId int64) *Room + func (r *Room) DeleteChannel(ch *Channel) bool + func (r *Room) Push(msg *pb.Msg) + func (r *Room) Put(ch *Channel) (err error) + type Server struct + Buckets []*Bucket + Ctx context.Context + Options ServerOptions + SvcCtx *svc.ServiceContext + var DefaultServer *Server + func NewServer(b []*Bucket, options ServerOptions) *Server + func (s *Server) Bucket(userId int64) *Bucket + func (s Server) Start() + func (s Server) Stop() + type ServerOptions struct + BroadcastSize int + MaxMessageSize int64 + PingPeriod time.Duration + PongWait time.Duration + ReadBufferSize int + WriteBufferSize int + WriteWait time.Duration