Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge js sdk #2856

Merged
merged 183 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
4c3c455
fix: GroupApplicationAcceptedNotification
withchao Jan 11, 2024
f5f2cf4
Merge remote-tracking branch 'origin/main'
withchao Jan 11, 2024
ad979d4
Merge branch 'openimsdk:main' into main
withchao Jan 11, 2024
a00d77a
fix: GroupApplicationAcceptedNotification
withchao Jan 11, 2024
48ff03f
fix: NotificationUserInfoUpdate
withchao Jan 12, 2024
45859d9
Merge branch 'openimsdk:main' into main
withchao Jan 16, 2024
e3d78de
Merge branch 'openimsdk:main' into main
withchao Jan 18, 2024
c81e199
Merge branch 'openimsdk:main' into main
withchao Jan 22, 2024
4266fed
cicd: robot automated Change
withchao Jan 22, 2024
1a14191
Merge remote-tracking branch 'upstream/main'
withchao Jan 26, 2024
86d3a66
Merge branch 'openimsdk:main' into main
withchao Jan 28, 2024
1964a4b
Merge branch 'openimsdk:main' into main
withchao Jan 31, 2024
d91cde9
Merge branch 'openimsdk:main' into main
withchao Feb 5, 2024
6a05e64
Merge branch 'openimsdk:main' into main
withchao Feb 20, 2024
39a6141
Merge branch 'openimsdk:main' into main
withchao Mar 6, 2024
c2009ce
Merge branch 'openimsdk:main' into main
withchao Mar 7, 2024
34c7f22
Merge branch 'openimsdk:main' into main
withchao Mar 8, 2024
ea9c75b
Merge branch 'openimsdk:main' into main
withchao Mar 13, 2024
7b5279a
fix: component
withchao Mar 13, 2024
34daf13
fix: getConversationInfo
withchao Mar 13, 2024
65d58ae
Merge branch 'openimsdk:main' into main
withchao Mar 13, 2024
e601b5f
Merge remote-tracking branch 'upstream/main'
withchao Mar 20, 2024
5f72b1e
Merge remote-tracking branch 'origin/main'
withchao Mar 20, 2024
20dfafd
Merge branch 'openimsdk:main' into main
withchao Apr 24, 2024
dc57d38
feat: cron task
withchao Apr 25, 2024
2f13149
feat: cron task
withchao Apr 25, 2024
2e43950
feat: cron task
withchao Apr 25, 2024
7a29a85
feat: cron task
withchao Apr 26, 2024
3920c06
feat: cron task
withchao Apr 26, 2024
bed7a60
Merge branch 'openimsdk:main' into main
withchao Apr 26, 2024
f2fbf19
Merge remote-tracking branch 'refs/remotes/origin/main' into corn37
withchao Apr 26, 2024
01851df
Merge remote-tracking branch 'upstream/main'
withchao Apr 28, 2024
480ccc7
fix: minio config url recognition error
withchao Apr 28, 2024
1046323
Merge branch 'openimsdk:main' into main
withchao May 8, 2024
76c6fe8
Merge branch 'openimsdk:main' into main
withchao May 10, 2024
6b119bd
Merge branch 'openimsdk:main' into main
withchao May 17, 2024
61740d4
Merge branch 'openimsdk:main' into main
withchao May 30, 2024
17dad5c
Merge branch 'openimsdk:main' into main
withchao Jun 12, 2024
5156795
Merge branch 'openimsdk:main' into main
withchao Jun 17, 2024
4781cf4
Merge branch 'openimsdk:main' into main
withchao Jul 1, 2024
bfbfb78
Merge branch 'openimsdk:main' into main
withchao Jul 3, 2024
8d4737c
update gomake version
withchao Jul 3, 2024
0b4c802
update gomake version
withchao Jul 3, 2024
a464750
Merge branch 'openimsdk:main' into main
withchao Jul 4, 2024
ab84d77
Merge branch 'openimsdk:main' into main
withchao Jul 5, 2024
df9bbeb
Merge branch 'openimsdk:main' into main
withchao Jul 9, 2024
fdb6ea7
Merge branch 'openimsdk:main' into main
withchao Jul 10, 2024
18cc83c
Merge branch 'openimsdk:main' into main
withchao Jul 11, 2024
33de30b
Merge branch 'openimsdk:main' into main
withchao Jul 15, 2024
71ba69b
Merge branch 'openimsdk:main' into main
withchao Jul 15, 2024
904c669
Merge branch 'openimsdk:main' into main
withchao Jul 17, 2024
6df8412
Merge branch 'openimsdk:main' into main
withchao Jul 17, 2024
2ce8d22
fix: seq conversion bug
withchao Jul 17, 2024
d521f0b
fix: redis pipe exec
withchao Jul 17, 2024
87b88e0
Merge branch 'openimsdk:main' into main
withchao Jul 17, 2024
091f9c3
Merge branch 'openimsdk:main' into main
withchao Jul 18, 2024
4d42fe9
Merge branch 'openimsdk:main' into main
withchao Jul 19, 2024
eca9abe
Merge branch 'openimsdk:main' into main
withchao Jul 22, 2024
f7bcbad
Merge branch 'openimsdk:main' into main
withchao Jul 24, 2024
0885703
Merge branch 'openimsdk:main' into main
withchao Jul 25, 2024
57b35ad
Merge branch 'openimsdk:main' into main
withchao Jul 26, 2024
ae5e433
Merge branch 'openimsdk:main' into main
withchao Jul 29, 2024
882d24b
fix: ImportFriends
withchao Jul 29, 2024
82c903a
Merge branch 'openimsdk:main' into main
withchao Jul 29, 2024
e4817d6
Merge branch 'openimsdk:main' into main
withchao Jul 31, 2024
9f1587f
Merge branch 'openimsdk:main' into main
withchao Jul 31, 2024
3b4d9f7
Merge branch 'openimsdk:main' into main
withchao Aug 1, 2024
e2bf593
Merge branch 'openimsdk:main' into main
withchao Aug 2, 2024
9e907e5
Merge branch 'openimsdk:main' into main
withchao Aug 6, 2024
31f1476
Merge branch 'openimsdk:main' into main
withchao Aug 13, 2024
0f86c4b
fix: A large number of logs keysAndValues ​​length is not even
withchao Aug 16, 2024
1fcb46b
Merge branch 'openimsdk:main' into main
withchao Aug 16, 2024
e112a4d
Merge branch 'openimsdk:main' into main
withchao Aug 19, 2024
62f58de
Merge branch 'openimsdk:main' into main
withchao Aug 21, 2024
c14dcb7
Merge branch 'openimsdk:main' into main
withchao Aug 23, 2024
6cf385b
feat: mark read aggregate write
withchao Aug 23, 2024
3b6463d
feat: online status supports redis cluster
withchao Aug 26, 2024
d2e1675
feat: online status supports redis cluster
withchao Aug 26, 2024
d0dcd9a
Merge remote-tracking branch 'upstream/main'
withchao Aug 26, 2024
770dac3
feat: online status supports redis cluster
withchao Aug 26, 2024
b909967
merge
withchao Aug 26, 2024
54a4241
Merge remote-tracking branch 'upstream/main'
withchao Aug 26, 2024
5f8713a
merge
withchao Aug 26, 2024
764b47e
read seq is written to mongo
withchao Aug 26, 2024
12bbd88
read seq is written to mongo
withchao Aug 26, 2024
bbbb682
Merge branch 'openimsdk:main' into main
withchao Aug 27, 2024
e7a4ef3
fix: invitation to join group notification
withchao Aug 27, 2024
45a2031
fix: friend op_user_id
withchao Aug 29, 2024
fa375f2
feat: optimizing asynchronous context
withchao Aug 29, 2024
6a2d8ef
feat: optimizing memamq size
withchao Aug 29, 2024
6a3c894
Merge remote-tracking branch 'upstream/main'
withchao Aug 29, 2024
2cfc354
Merge branch 'openimsdk:main' into main
withchao Aug 29, 2024
36ff8d4
Merge branch 'openimsdk:main' into main
withchao Aug 31, 2024
790f39f
feat: add GetSeqMessage
withchao Aug 31, 2024
6890da4
feat: implement no gob encoder.
mo3et Sep 2, 2024
165eecf
update unitTest content.
mo3et Sep 2, 2024
9b94063
Merge pull request #2588 from mo3et/fix/gateway
mo3et Sep 3, 2024
71f328e
Update hub_server.go
FGadvancer Sep 3, 2024
f65cfba
feat: GroupApplicationAgreeMemberEnterNotification
withchao Sep 3, 2024
758606f
fix: encoder replace to json encoder.
FGadvancer Sep 3, 2024
39f529d
feat: GroupApplicationAgreeMemberEnterNotification
withchao Sep 3, 2024
e3b808e
Merge remote-tracking branch 'refs/remotes/upstream/main'
withchao Sep 3, 2024
74c8dc4
feat: go.mod
withchao Sep 3, 2024
4c14282
feat: go.mod
withchao Sep 3, 2024
bf3cfa1
feat: join group notification and get seq
withchao Sep 4, 2024
c9e98c7
feat: join group notification and get seq
withchao Sep 5, 2024
f73f169
Merge remote-tracking branch 'upstream/main'
withchao Sep 5, 2024
4b56b6f
Merge branch 'openimsdk:main' into main
withchao Sep 5, 2024
a46fae3
feat: avoid pulling messages from sessions with a large number of max…
withchao Sep 9, 2024
b378b57
Merge branch 'openimsdk:main' into main
withchao Sep 10, 2024
246a366
Merge branch 'openimsdk:main' into main
withchao Sep 11, 2024
5b134bc
feat: API supports gzip
withchao Sep 11, 2024
6c76d69
Merge remote-tracking branch 'upstream/main'
withchao Sep 12, 2024
59d606c
go.mod
withchao Sep 12, 2024
ab3517b
Merge branch 'openimsdk:main' into main
withchao Sep 12, 2024
f7f0af2
fix: nil pointer error on close
withchao Sep 12, 2024
b2473bc
Merge remote-tracking branch 'origin/main'
withchao Sep 12, 2024
b65f594
fix: listen error
withchao Sep 12, 2024
3677e78
Merge branch 'openimsdk:main' into main
withchao Sep 12, 2024
70532d5
fix: listen error
withchao Sep 12, 2024
747c00a
Merge remote-tracking branch 'origin/main'
withchao Sep 12, 2024
eb45a0c
Merge remote-tracking branch 'upstream/main'
withchao Sep 12, 2024
f83004a
update go.mod
withchao Sep 12, 2024
91865f0
Merge branch 'openimsdk:main' into main
withchao Sep 18, 2024
bcf397c
feat: add log
withchao Sep 18, 2024
f5c27ed
Merge branch 'openimsdk:main' into main
withchao Sep 18, 2024
25c035d
Merge branch 'openimsdk:main' into main
withchao Sep 23, 2024
bd423ed
fix: token parse token value
withchao Sep 23, 2024
befe568
fix: GetMsgBySeqs boundary issues
withchao Sep 23, 2024
6b04325
Merge branch 'openimsdk:main' into main
withchao Sep 23, 2024
38a989b
merge: merge main code into js branch. (#2648)
FGadvancer Sep 23, 2024
e8863c8
Merge branch 'openimsdk:main' into main
withchao Sep 23, 2024
4ec092e
Merge branch 'openimsdk:main' into main
withchao Sep 26, 2024
678c230
Merge branch 'main' of github.com:openimsdk/open-im-server into v3.8-…
mo3et Sep 26, 2024
c8dd598
update go mod
mo3et Sep 26, 2024
f6ad1d3
Merge branch 'openimsdk:main' into main
withchao Sep 27, 2024
152159e
Merge branch 'openimsdk:main' into main
withchao Sep 29, 2024
e723803
fix: sn_ not sort
withchao Sep 29, 2024
6135b68
Merge branch 'openimsdk:main' into main
withchao Sep 29, 2024
a390c00
fix: sn_ not sort
withchao Sep 29, 2024
627e2be
Merge remote-tracking branch 'origin/main'
withchao Sep 29, 2024
0e5d0d6
fix: sn_ not sort
withchao Sep 29, 2024
1272048
Merge branch 'openimsdk:main' into main
withchao Sep 29, 2024
122bf66
Merge branch 'openimsdk:main' into main
withchao Oct 11, 2024
0e13614
fix: jssdk add
withchao Oct 11, 2024
8ea2cf8
fix: jssdk support
withchao Oct 12, 2024
48b7b15
fix: jssdk support
withchao Oct 12, 2024
4525638
fix: jssdk support
withchao Oct 12, 2024
38ae4e5
Merge branch 'openimsdk:main' into main
withchao Oct 14, 2024
bcc7e77
fix: the message I sent is not set to read seq in mongodb
withchao Oct 14, 2024
f6133dd
Merge branch 'openimsdk:main' into main
withchao Oct 14, 2024
62f1c14
fix: cannot modify group member avatars
withchao Oct 14, 2024
2311bfa
Merge branch 'openimsdk:main' into main
withchao Oct 14, 2024
9fb5ee5
merge: update code from main to v3.8-js-sdk-only. (#2720)
FGadvancer Oct 14, 2024
97fcbc8
Merge branch 'openimsdk:main' into main
withchao Oct 14, 2024
2644b59
Merge branch 'openimsdk:main' into main
withchao Oct 16, 2024
78a7219
fix: MemberEnterNotification
withchao Oct 23, 2024
82e6025
fix: MemberEnterNotification
withchao Oct 23, 2024
1c563a3
Merge branch 'openimsdk:main' into main
withchao Oct 24, 2024
f5fa272
fix: MsgData status
withchao Oct 24, 2024
52c8a09
Merge branch 'openimsdk:main' into main
withchao Oct 24, 2024
62b1fa7
Merge branch 'openimsdk:main' into main
withchao Oct 25, 2024
132623a
Merge branch 'openimsdk:main' into main
withchao Oct 25, 2024
5041942
Merge remote-tracking branch 'origin/main' into v3.8-js-sdk-only
withchao Oct 25, 2024
646f1b9
merge
withchao Oct 25, 2024
8653d19
Merge branch 'openimsdk:main' into main
withchao Oct 30, 2024
c707205
Merge branch 'openimsdk:main' into main
withchao Oct 30, 2024
7b95c2c
Merge branch 'openimsdk:main' into main
withchao Oct 30, 2024
ee04c15
merge: update code from main to v3.8-js-sdk-only. (#2818)
FGadvancer Oct 31, 2024
c025c72
Merge branch 'openimsdk:main' into main
withchao Nov 1, 2024
b49a8dd
feat: support text ping pong
withchao Nov 4, 2024
bf00aa7
Merge pull request #2829 from withchao/v3.8-js-sdk-only
withchao Nov 4, 2024
f185c98
feat: support text ping pong
withchao Nov 5, 2024
d3ad395
Merge branch 'openimsdk:main' into main
withchao Nov 5, 2024
df03c76
Merge pull request #2839 from withchao/v3.8-js-sdk-only
withchao Nov 5, 2024
caafefd
Merge branch 'openimsdk:main' into main
withchao Nov 11, 2024
97d10f9
feat: gob json encoder
withchao Nov 14, 2024
789a215
Merge remote-tracking branch 'origin/v3.8-js-sdk-only'
withchao Nov 14, 2024
b7e6046
feat: gob json encoder
withchao Nov 14, 2024
022a543
feat: gob json encoder
withchao Nov 14, 2024
d63ed8c
feat: gob json encoder
withchao Nov 14, 2024
c078730
feat: gob json encoder
withchao Nov 14, 2024
18fbe03
feat: gob json encoder
withchao Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/openim-msggateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ longConnSvr:
websocketMaxMsgLen: 4096
# WebSocket connection handshake timeout in seconds
websocketTimeout: 10


26 changes: 13 additions & 13 deletions config/openim-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ maxConcurrentWorkers: 3
enable: geTui
geTui:
pushUrl: https://restapi.getui.com/v2/$appId
masterSecret:
appKey:
intent:
channelID:
channelName:
masterSecret:
appKey:
intent:
channelID:
channelName:
fcm:
# Prioritize using file paths. If the file path is empty, use URL
filePath: # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
filePath: # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
authURL: # Must start with https or http.
jpns:
appKey:
masterSecret:
pushURL:
pushIntent:
appKey:
masterSecret:
pushURL:
pushIntent:

# iOS system push sound and badge count
iosPush:
pushSound: xxx
badgeCount: true
production: false
pushSound: xxx
badgeCount: true
production: false

fullUserCache: true
45 changes: 40 additions & 5 deletions internal/msggateway/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package msggateway

import (
"context"
"encoding/json"
"fmt"
"runtime/debug"
"sync"
Expand Down Expand Up @@ -69,6 +70,8 @@ type Client struct {
IsCompress bool `json:"isCompress"`
UserID string `json:"userID"`
IsBackground bool `json:"isBackground"`
SDKType string `json:"sdkType"`
Encoder Encoder
ctx *UserConnContext
longConnServer LongConnServer
closed atomic.Bool
Expand All @@ -94,11 +97,17 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, longConnServer
c.closed.Store(false)
c.closedErr = nil
c.token = ctx.GetToken()
c.SDKType = ctx.GetSDKType()
c.hbCtx, c.hbCancel = context.WithCancel(c.ctx)
c.subLock = new(sync.Mutex)
if c.subUserIDs != nil {
clear(c.subUserIDs)
}
if c.SDKType == GoSDK {
c.Encoder = NewGobEncoder()
} else {
c.Encoder = NewJsonEncoder()
}
c.subUserIDs = make(map[string]struct{})
}

Expand Down Expand Up @@ -159,9 +168,12 @@ func (c *Client) readMessage() {
return
}
case MessageText:
c.closedErr = ErrNotSupportMessageProtocol
return

_ = c.conn.SetReadDeadline(pongWait)
parseDataErr := c.handlerTextMessage(message)
if parseDataErr != nil {
c.closedErr = parseDataErr
return
}
case PingMessage:
err := c.writePongMsg("")
log.ZError(c.ctx, "writePongMsg", err)
Expand All @@ -188,7 +200,7 @@ func (c *Client) handleMessage(message []byte) error {
var binaryReq = getReq()
defer freeReq(binaryReq)

err := c.longConnServer.Decode(message, binaryReq)
err := c.Encoder.Decode(message, binaryReq)
if err != nil {
return err
}
Expand Down Expand Up @@ -335,7 +347,7 @@ func (c *Client) writeBinaryMsg(resp Resp) error {
return nil
}

encodedBuf, err := c.longConnServer.Encode(resp)
encodedBuf, err := c.Encoder.Encode(resp)
if err != nil {
return err
}
Expand Down Expand Up @@ -419,3 +431,26 @@ func (c *Client) writePongMsg(appData string) error {

return errs.Wrap(err)
}

func (c *Client) handlerTextMessage(b []byte) error {
var msg TextMessage
if err := json.Unmarshal(b, &msg); err != nil {
return err
}
switch msg.Type {
case TextPong:
return nil
case TextPing:
msg.Type = TextPong
msgData, err := json.Marshal(msg)
if err != nil {
return err
}
if err := c.conn.SetWriteDeadline(writeWait); err != nil {
return err
}
return c.conn.WriteMessage(MessageText, msgData)
default:
return fmt.Errorf("not support message type %s", msg.Type)
}
}
6 changes: 6 additions & 0 deletions internal/msggateway/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const (
GzipCompressionProtocol = "gzip"
BackgroundStatus = "isBackground"
SendResponse = "isMsgResp"
SDKType = "sdkType"
)

const (
GoSDK = "go"
JsSDK = "js"
)

const (
Expand Down
14 changes: 13 additions & 1 deletion internal/msggateway/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ func (c *UserConnContext) GetCompression() bool {
return false
}

func (c *UserConnContext) GetSDKType() string {
sdkType := c.Req.URL.Query().Get(SDKType)
if sdkType == "" {
sdkType = GoSDK
}
return sdkType
}

func (c *UserConnContext) ShouldSendResp() bool {
errResp, exists := c.Query(SendResponse)
if exists {
Expand Down Expand Up @@ -193,7 +201,11 @@ func (c *UserConnContext) ParseEssentialArgs() error {
_, err := strconv.Atoi(platformIDStr)
if err != nil {
return servererrs.ErrConnArgsErr.WrapMsg("platformID is not int")

}
switch sdkType, _ := c.Query(SDKType); sdkType {
case "", GoSDK, JsSDK:
default:
return servererrs.ErrConnArgsErr.WrapMsg("sdkType is not go or js")
}
return nil
}
33 changes: 28 additions & 5 deletions internal/msggateway/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package msggateway
import (
"bytes"
"encoding/gob"
"encoding/json"

"github.com/openimsdk/tools/errs"
)
Expand All @@ -28,24 +29,46 @@ type Encoder interface {

type GobEncoder struct{}

func NewGobEncoder() *GobEncoder {
return &GobEncoder{}
func NewGobEncoder() Encoder {
return GobEncoder{}
}

func (g *GobEncoder) Encode(data any) ([]byte, error) {
buff := bytes.Buffer{}
func (g GobEncoder) Encode(data any) ([]byte, error) {
var buff bytes.Buffer
enc := gob.NewEncoder(&buff)
if err := enc.Encode(data); err != nil {
return nil, errs.WrapMsg(err, "GobEncoder.Encode failed", "action", "encode")
}
return buff.Bytes(), nil
}

func (g *GobEncoder) Decode(encodeData []byte, decodeData any) error {
func (g GobEncoder) Decode(encodeData []byte, decodeData any) error {
buff := bytes.NewBuffer(encodeData)
dec := gob.NewDecoder(buff)
if err := dec.Decode(decodeData); err != nil {
return errs.WrapMsg(err, "GobEncoder.Decode failed", "action", "decode")
}
return nil
}

type JsonEncoder struct{}

func NewJsonEncoder() Encoder {
return JsonEncoder{}
}

func (g JsonEncoder) Encode(data any) ([]byte, error) {
b, err := json.Marshal(data)
if err != nil {
return nil, errs.New("JsonEncoder.Encode failed", "action", "encode")
}
return b, nil
}

func (g JsonEncoder) Decode(encodeData []byte, decodeData any) error {
err := json.Unmarshal(encodeData, decodeData)
if err != nil {
return errs.New("JsonEncoder.Decode failed", "action", "decode")
}
return nil
}
16 changes: 4 additions & 12 deletions internal/msggateway/hub_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,11 @@ func NewServer(rpcPort int, longConnServer LongConnServer, conf *Config, ready f
return s
}

func (s *Server) OnlinePushMsg(
context context.Context,
req *msggateway.OnlinePushMsgReq,
) (*msggateway.OnlinePushMsgResp, error) {
func (s *Server) OnlinePushMsg(context context.Context, req *msggateway.OnlinePushMsgReq) (*msggateway.OnlinePushMsgResp, error) {
panic("implement me")
}

func (s *Server) GetUsersOnlineStatus(
ctx context.Context,
req *msggateway.GetUsersOnlineStatusReq,
) (*msggateway.GetUsersOnlineStatusResp, error) {
func (s *Server) GetUsersOnlineStatus(ctx context.Context, req *msggateway.GetUsersOnlineStatusReq) (*msggateway.GetUsersOnlineStatusResp, error) {
if !authverify.IsAppManagerUid(ctx, s.config.Share.IMAdminUserID) {
return nil, errs.ErrNoPermission.WrapMsg("only app manager")
}
Expand Down Expand Up @@ -155,6 +149,7 @@ func (s *Server) pushToUser(ctx context.Context, userID string, msgData *sdkws.M
(client.IsBackground && client.PlatformID != constant.IOSPlatformID) {
err := client.PushMessage(ctx, msgData)
if err != nil {
log.ZWarn(ctx, "online push msg failed", err, "userID", userID, "platformID", client.PlatformID)
userPlatform.ResultCode = int64(servererrs.ErrPushMsgErr.Code())
} else {
if _, ok := s.pushTerminal[client.PlatformID]; ok {
Expand Down Expand Up @@ -220,10 +215,7 @@ func (s *Server) SuperGroupOnlineBatchPushOneMsg(ctx context.Context, req *msgga
}
}

func (s *Server) KickUserOffline(
ctx context.Context,
req *msggateway.KickUserOfflineReq,
) (*msggateway.KickUserOfflineResp, error) {
func (s *Server) KickUserOffline(ctx context.Context, req *msggateway.KickUserOfflineReq) (*msggateway.KickUserOfflineResp, error) {
for _, v := range req.KickUserIDList {
clients, _, ok := s.LongConnServer.GetUserPlatformCons(v, int(req.PlatformID))
if !ok {
Expand Down
11 changes: 11 additions & 0 deletions internal/msggateway/message_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package msggateway

import (
"context"
"encoding/json"
"sync"

"github.com/go-playground/validator/v10"
Expand All @@ -31,6 +32,16 @@ import (
"github.com/openimsdk/tools/utils/jsonutil"
)

const (
TextPing = "ping"
TextPong = "pong"
)

type TextMessage struct {
Type string `json:"type"`
Body json.RawMessage `json:"body"`
}

type Req struct {
ReqIdentifier int32 `json:"reqIdentifier" validate:"required"`
Token string `json:"token"`
Expand Down
13 changes: 2 additions & 11 deletions internal/msggateway/ws_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type LongConnServer interface {
SetKickHandlerInfo(i *kickHandler)
SubUserOnlineStatus(ctx context.Context, client *Client, data *Req) ([]byte, error)
Compressor
Encoder
MessageHandler
}

Expand All @@ -61,7 +60,7 @@ type WsServer struct {
authClient *rpcclient.Auth
disCov discovery.SvcDiscoveryRegistry
Compressor
Encoder
//Encoder
MessageHandler
webhookClient *webhook.Client
}
Expand Down Expand Up @@ -135,7 +134,6 @@ func NewWsServer(msgGatewayConfig *Config, opts ...Option) *WsServer {
clients: newUserMap(),
subscription: newSubscription(),
Compressor: NewGzipCompressor(),
Encoder: NewGobEncoder(),
webhookClient: webhook.NewWebhookClient(msgGatewayConfig.WebhooksConfig.URL),
}
}
Expand Down Expand Up @@ -278,14 +276,7 @@ func (ws *WsServer) registerClient(client *Client) {

wg.Wait()

log.ZDebug(
client.ctx,
"user online",
"online user Num",
ws.onlineUserNum.Load(),
"online user conn Num",
ws.onlineUserConnNum.Load(),
)
log.ZDebug(client.ctx, "user online", "online user Num", ws.onlineUserNum.Load(), "online user conn Num", ws.onlineUserConnNum.Load())
}

func getRemoteAdders(client []*Client) string {
Expand Down
7 changes: 3 additions & 4 deletions pkg/common/storage/controller/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package controller

import (
"context"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey"
"github.com/openimsdk/tools/log"

"github.com/golang-jwt/jwt/v4"
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey"
"github.com/openimsdk/protocol/constant"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/log"
"github.com/openimsdk/tools/tokenverify"
)

Expand Down
Loading