module

package
v3.8.3-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HundredThousandGroupUserNum = 100000
	TenThousandGroupUserNum     = 10000
	ThousandGroupUserNum        = 1000
	HundredGroupUserNum         = 100
	FiftyGroupUserNum           = 50
	TenGroupUserNum             = 10

	HundredThousandGroupNum = 1
	TenThousandGroupNum     = 2
	ThousandGroupNum        = 5
	HundredGroupNum         = 50
	FiftyGroupNum           = 100
	TenGroupNum             = 1000

	FastenedUserPrefix = "test_v3_u"
	OfflineUserPrefix  = "o"
	RecvMsgPrefix      = "recv_msg_prefix"
)
View Source
const (
	ManagerUserID = "openIMAdmin"
)

Variables

View Source
var (
	TESTIP        = "127.0.0.1"
	APIADDR       = fmt.Sprintf("http://%v:10002", TESTIP)
	WSADDR        = fmt.Sprintf("ws://%v:10001", TESTIP)
	SECRET        = "openIM123"
	MANAGERUSERID = "imAdmin"

	PLATFORMID = constant.AndroidPlatformID
	LogLevel   = uint32(5)
)
View Source
var (
	NotFriendMsgSenderNum = 200 // not friend msg sender num

)
View Source
var (
	QPSChan chan int64 // Channel used for periodic updates to qpsCounter
)

Functions

func GetQPS added in v3.8.0

func GetQPS() int64

func IncrementQPS added in v3.8.0

func IncrementQPS()

func WithRecvPushMsgCallback

func WithRecvPushMsgCallback(callback func(msg *sdkws.MsgData)) func(core *SendMsgUser)

Types

type ApiMsgSender

type ApiMsgSender struct {
	*MetaManager
}

func (*ApiMsgSender) SendMsg

func (a *ApiMsgSender) SendMsg(sendID, recvID string, index int) error

type ConnListener added in v3.8.0

type ConnListener struct{}

func (*ConnListener) OnConnectFailed added in v3.8.0

func (c *ConnListener) OnConnectFailed(errCode int32, errMsg string)

func (*ConnListener) OnConnectSuccess added in v3.8.0

func (c *ConnListener) OnConnectSuccess()

func (*ConnListener) OnConnecting added in v3.8.0

func (c *ConnListener) OnConnecting()

func (*ConnListener) OnKickedOffline added in v3.8.0

func (c *ConnListener) OnKickedOffline()

func (*ConnListener) OnUserTokenExpired added in v3.8.0

func (c *ConnListener) OnUserTokenExpired()

func (*ConnListener) OnUserTokenInvalid added in v3.8.0

func (c *ConnListener) OnUserTokenInvalid(errMsg string)

type MetaManager

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

func NewMetaManager

func NewMetaManager(apiAddr, secret, managerUserID string) *MetaManager

func (*MetaManager) GetServerTime

func (m *MetaManager) GetServerTime() (int64, error)

func (*MetaManager) NewApiMsgSender

func (m *MetaManager) NewApiMsgSender() *ApiMsgSender

func (*MetaManager) NewFriendManager

func (m *MetaManager) NewFriendManager() *TestFriendManager

func (*MetaManager) NewGroupMananger

func (m *MetaManager) NewGroupMananger() *TestGroupManager

func (*MetaManager) NewUserManager

func (m *MetaManager) NewUserManager() *TestUserManager

type PressureTester added in v3.8.0

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

func NewPressureTester added in v3.8.0

func NewPressureTester() (*PressureTester, error)

func (*PressureTester) CheckMsg added in v3.8.0

func (p *PressureTester) CheckMsg(ctx context.Context)

func (*PressureTester) CreateTestGroups added in v3.8.0

func (p *PressureTester) CreateTestGroups(fastenedUserIDs []string, total int, groupSenderRate, groupOnlineRate float64, hundredThousandGroupNum, tenThousandGroupNum, thousandGroupNum,
	hundredGroupNum, fiftyGroupNum, tenGroupNum int) (err error)

func (*PressureTester) FormatGroupInfo added in v3.8.0

func (p *PressureTester) FormatGroupInfo(ctx context.Context)

func (*PressureTester) GetSingleSendNum added in v3.8.0

func (p *PressureTester) GetSingleSendNum() int64

func (*PressureTester) InitUserConns added in v3.8.0

func (p *PressureTester) InitUserConns(userIDs []string)

func (*PressureTester) RegisterUsers added in v3.8.0

func (p *PressureTester) RegisterUsers(userIDs []string, fastenedUserIDs []string, recvMsgUserIDs []string) error

func (*PressureTester) SelectSample added in v3.8.0

func (p *PressureTester) SelectSample(total int, percentage float64) (fastenedUserIDs []string,
	sampleReceiver, offlineUserIDs []string, err error)

selectSample

func (*PressureTester) SelectSampleFromStarEnd added in v3.8.0

func (p *PressureTester) SelectSampleFromStarEnd(start, end int, percentage float64) (fastenedUserIDs []string,
	sampleReceiver, offlineUserIDs []string, err error)

func (*PressureTester) SelectStartAndEnd added in v3.8.0

func (p *PressureTester) SelectStartAndEnd(start, end int) (fastenedUserIDs []string)

func (*PressureTester) SendGroupMessage added in v3.8.0

func (p *PressureTester) SendGroupMessage(ctx context.Context, num int, duration time.Duration)

func (*PressureTester) SendMessages added in v3.8.0

func (p *PressureTester) SendMessages(sendID, recvID string, msgNum int)

func (*PressureTester) SendSingleMessages added in v3.8.0

func (p *PressureTester) SendSingleMessages(ctx context.Context, fastenedUserIDs []string, randomSender []string, randomReceiver, num int, duration time.Duration)

func (*PressureTester) SendSingleMessagesTo added in v3.8.0

func (p *PressureTester) SendSingleMessagesTo(fastenedUserIDs []string, num int, duration time.Duration)

func (*PressureTester) SetOfflineUserIDs added in v3.8.0

func (p *PressureTester) SetOfflineUserIDs(offlineUserIDs []string)

func (*PressureTester) Shuffle added in v3.8.0

func (p *PressureTester) Shuffle(fastenedUserIDs []string, needNum int) []string

Shuffle gets random userID from fastenedUserIDs and returns a slice of userID with length of needNum.

type SendMsg

type SendMsg struct {
	SendID           string                 `json:"sendID"           binding:"required"`
	GroupID          string                 `json:"groupID"          binding:"required_if=SessionType 2|required_if=SessionType 3"`
	SenderNickname   string                 `json:"senderNickname"`
	SenderFaceURL    string                 `json:"senderFaceURL"`
	SenderPlatformID int32                  `json:"senderPlatformID"`
	Content          map[string]interface{} `json:"content"          binding:"required"                                            swaggerignore:"true"`
	ContentType      int32                  `json:"contentType"      binding:"required"`
	SessionType      int32                  `json:"sessionType"      binding:"required"`
	IsOnlineOnly     bool                   `json:"isOnlineOnly"`
	NotOfflinePush   bool                   `json:"notOfflinePush"`
	OfflinePushInfo  *sdkws.OfflinePushInfo `json:"offlinePushInfo"`
}

type SendMsgReq

type SendMsgReq struct {
	RecvID string `json:"recvID" binding:"required_if" message:"recvID is required if sessionType is SingleChatType or NotificationChatType"`
	SendMsg
}

type SendMsgUser

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

func NewUser

func NewUser(userID, token string, timeOffset int64, p *PressureTester, imConfig sdk_struct.IMConfig, opts ...func(core *SendMsgUser)) *SendMsgUser

func (*SendMsgUser) BatchSendGroupMsg

func (b *SendMsgUser) BatchSendGroupMsg(ctx context.Context, groupID string, index int) error

func (*SendMsgUser) BatchSendSingleMsg

func (b *SendMsgUser) BatchSendSingleMsg(ctx context.Context, userID string, index int) error

func (*SendMsgUser) Close

func (b *SendMsgUser) Close(ctx context.Context)

func (*SendMsgUser) GetRelativeServerTime added in v3.8.0

func (b *SendMsgUser) GetRelativeServerTime() int64

func (*SendMsgUser) GetUserID

func (b *SendMsgUser) GetUserID() string

func (*SendMsgUser) LongConnMgr added in v3.8.0

func (b *SendMsgUser) LongConnMgr() *interaction.LongConnMgr

func (*SendMsgUser) SendGroupMsg

func (b *SendMsgUser) SendGroupMsg(ctx context.Context, groupID string, index int) error

func (*SendMsgUser) SendGroupMsgWithContext

func (b *SendMsgUser) SendGroupMsgWithContext(groupID string, index int) error

func (*SendMsgUser) SendMsgWithContext

func (b *SendMsgUser) SendMsgWithContext(userID string, index int) error

func (*SendMsgUser) SendSingleMsg

func (b *SendMsgUser) SendSingleMsg(ctx context.Context, userID string, index int) error

type TestFriendManager

type TestFriendManager struct {
	*MetaManager
}

func (*TestFriendManager) ImportFriends

func (t *TestFriendManager) ImportFriends(ownerUserID string, friendUserIDs []string) error

type TestGroupManager

type TestGroupManager struct {
	*MetaManager
}

func (*TestGroupManager) CreateGroup

func (t *TestGroupManager) CreateGroup(groupID string, groupName string, ownerUserID string, userIDs []string) error

func (*TestGroupManager) GenGroupID

func (t *TestGroupManager) GenGroupID(prefix string) string

func (*TestGroupManager) InviteUserToGroup

func (t *TestGroupManager) InviteUserToGroup(ctx context.Context, groupID string, invitedUserIDs []string) error

type TestUserManager

type TestUserManager struct {
	*MetaManager
}

func (*TestUserManager) GenSEUserIDsWithPrefix added in v3.8.0

func (t *TestUserManager) GenSEUserIDsWithPrefix(start, end int, prefix string) (userIDs []string)

func (*TestUserManager) GenUserIDs

func (t *TestUserManager) GenUserIDs(num int) (userIDs []string)

func (*TestUserManager) GenUserIDsWithPrefix

func (t *TestUserManager) GenUserIDsWithPrefix(num int, prefix string) (userIDs []string)

func (*TestUserManager) GetToken

func (t *TestUserManager) GetToken(userID string, platformID int32) (string, error)

func (*TestUserManager) RegisterUsers

func (t *TestUserManager) RegisterUsers(userIDs ...string) error

type UserListener added in v3.8.0

type UserListener struct{}

func (*UserListener) OnSelfInfoUpdated added in v3.8.0

func (u *UserListener) OnSelfInfoUpdated(userInfo string)

func (*UserListener) OnUserCommandAdd added in v3.8.0

func (u *UserListener) OnUserCommandAdd(userCommand string)

func (*UserListener) OnUserCommandDelete added in v3.8.0

func (u *UserListener) OnUserCommandDelete(userCommand string)

func (*UserListener) OnUserCommandUpdate added in v3.8.0

func (u *UserListener) OnUserCommandUpdate(userCommand string)

func (*UserListener) OnUserStatusChanged added in v3.8.0

func (u *UserListener) OnUserStatusChanged(userOnlineStatus string)

Jump to

Keyboard shortcuts

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