Documentation ¶
Index ¶
- Constants
- Variables
- func GetQPS() int64
- func IncrementQPS()
- func WithRecvPushMsgCallback(callback func(msg *sdkws.MsgData)) func(core *SendMsgUser)
- type ApiMsgSender
- type ConnListener
- type MetaManager
- type PressureTester
- func (p *PressureTester) CheckMsg(ctx context.Context)
- func (p *PressureTester) CreateTestGroups(fastenedUserIDs []string, total int, groupSenderRate, groupOnlineRate float64, ...) (err error)
- func (p *PressureTester) FormatGroupInfo(ctx context.Context)
- func (p *PressureTester) GetSingleSendNum() int64
- func (p *PressureTester) InitUserConns(userIDs []string)
- func (p *PressureTester) RegisterUsers(userIDs []string, fastenedUserIDs []string, recvMsgUserIDs []string) error
- func (p *PressureTester) SelectSample(total int, percentage float64) (fastenedUserIDs []string, sampleReceiver, offlineUserIDs []string, err error)
- func (p *PressureTester) SelectSampleFromStarEnd(start, end int, percentage float64) (fastenedUserIDs []string, sampleReceiver, offlineUserIDs []string, err error)
- func (p *PressureTester) SelectStartAndEnd(start, end int) (fastenedUserIDs []string)
- func (p *PressureTester) SendGroupMessage(ctx context.Context, num int, duration time.Duration)
- func (p *PressureTester) SendMessages(sendID, recvID string, msgNum int)
- func (p *PressureTester) SendSingleMessages(ctx context.Context, fastenedUserIDs []string, randomSender []string, ...)
- func (p *PressureTester) SendSingleMessagesTo(fastenedUserIDs []string, num int, duration time.Duration)
- func (p *PressureTester) SetOfflineUserIDs(offlineUserIDs []string)
- func (p *PressureTester) Shuffle(fastenedUserIDs []string, needNum int) []string
- type SendMsg
- type SendMsgReq
- type SendMsgUser
- func (b *SendMsgUser) BatchSendGroupMsg(ctx context.Context, groupID string, index int) error
- func (b *SendMsgUser) BatchSendSingleMsg(ctx context.Context, userID string, index int) error
- func (b *SendMsgUser) Close(ctx context.Context)
- func (b *SendMsgUser) GetRelativeServerTime() int64
- func (b *SendMsgUser) GetUserID() string
- func (b *SendMsgUser) LongConnMgr() *interaction.LongConnMgr
- func (b *SendMsgUser) SendGroupMsg(ctx context.Context, groupID string, index int) error
- func (b *SendMsgUser) SendGroupMsgWithContext(groupID string, index int) error
- func (b *SendMsgUser) SendMsgWithContext(userID string, index int) error
- func (b *SendMsgUser) SendSingleMsg(ctx context.Context, userID string, index int) error
- type TestFriendManager
- type TestGroupManager
- type TestUserManager
- func (t *TestUserManager) GenSEUserIDsWithPrefix(start, end int, prefix string) (userIDs []string)
- func (t *TestUserManager) GenUserIDs(num int) (userIDs []string)
- func (t *TestUserManager) GenUserIDsWithPrefix(num int, prefix string) (userIDs []string)
- func (t *TestUserManager) GetToken(userID string, platformID int32) (string, error)
- func (t *TestUserManager) RegisterUsers(userIDs ...string) error
- type UserListener
- func (u *UserListener) OnSelfInfoUpdated(userInfo string)
- func (u *UserListener) OnUserCommandAdd(userCommand string)
- func (u *UserListener) OnUserCommandDelete(userCommand string)
- func (u *UserListener) OnUserCommandUpdate(userCommand string)
- func (u *UserListener) OnUserStatusChanged(userOnlineStatus string)
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 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
}
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 (*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 (*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 (*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 (*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)
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 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 (*SendMsgUser) BatchSendSingleMsg ¶
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 (*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 ¶
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 (*TestGroupManager) GenGroupID ¶
func (t *TestGroupManager) GenGroupID(prefix string) string
func (*TestGroupManager) InviteUserToGroup ¶
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)
Click to show internal directories.
Click to hide internal directories.