Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Dec 10, 2021
2 parents 581c7db + 5916897 commit ef72a5c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion open_im_sdk/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var UserSDKRwLock sync.RWMutex
var UserRouterMap map[string]*UserRelated
var SvrConf IMConfig
var SdkLogFlag int32

var HearbeatInterval int32 = 5
var userForSDK *UserRelated

const (
Expand Down
2 changes: 1 addition & 1 deletion open_im_sdk/init_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func (u *UserRelated) heartbeat() {

u.DelCh(msgIncr)
LogEnd("DelCh", wsReq.OperationID)
time.Sleep(time.Duration(5) * time.Second)
time.Sleep(time.Duration(HearbeatInterval) * time.Second)
}
}

Expand Down
4 changes: 4 additions & 0 deletions open_im_sdk/open_im_sdk_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func SetSdkLog(flag int32) {
SdkLogFlag = flag
}

func SetHearbeatInterval(interval int32) {
HearbeatInterval = interval
}

func UnInitSDK() {
if userForSDK == nil {
sdkLog("userForSDK nil")
Expand Down
2 changes: 1 addition & 1 deletion open_im_sdk/ws_wrapper/open_im_sdk_my.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
var openIMWsAddress, openIMApiAddress *string
APIADDR := "http://121.37.25.71:10000"
WSADDR := "ws://121.37.25.71:17778"

open_im_sdk.SetHearbeatInterval(300)
sysType := runtime.GOOS
switch sysType {
case "darwin":
Expand Down
3 changes: 2 additions & 1 deletion open_im_sdk/ws_wrapper/open_im_sdk_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {
openIMApiPort = flag.Int("openIM_api_port", 10000, "openIM api listening port")
openIMWsPort = flag.Int("openIM_ws_port", 17778, "openIM ws listening port")
flag.Parse()

open_im_sdk.SetHearbeatInterval(300)
//switch *openIMTerminalType {
//case "pc":
// openIMWsAddress = flag.String("openIM_ws_address", "web", "different terminal types")
Expand All @@ -42,6 +42,7 @@ func main() {

sysType := runtime.GOOS
switch sysType {

case "darwin":
ws_local_server.InitServer(&open_im_sdk.IMConfig{IpApiAddr: *openIMApiAddress,
IpWsAddr: *openIMWsAddress, Platform: utils.OSXPlatformID, DbDir: "./"})
Expand Down
13 changes: 7 additions & 6 deletions test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,20 @@ func getMyIP() string {
}

var (
APIADDR = "http://43.128.5.63:10000"
WSADDR = "ws://43.128.5.63:17778"
REGISTERADDR = "http://43.128.5.63:10000/auth/user_register"
TOKENADDR = "http://43.128.5.63:10000/auth/user_token"
TESTIP = "43.128.5.63"
APIADDR = "http://" + TESTIP + ":10000"
WSADDR = "ws://" + TESTIP + ":17778"
REGISTERADDR = APIADDR + "/user_register"
TOKENADDR = APIADDR + "/auth/user_token"
SECRET = "tuoyun"
SENDINTERVAL = 20
)

// myuid, maxuid, msgnum
func main() {

open_im_sdk.SetHearbeatInterval(300)
for i := 0; i < 1; i++ {
myUid1 := 18666662412
myUid1 := 17712341234
strMyUid1 := GenUid(myUid1)

runRigister(strMyUid1)
Expand Down

0 comments on commit ef72a5c

Please sign in to comment.