mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-10 12:05:58 +08:00
push
This commit is contained in:
+12
-13
@@ -129,20 +129,19 @@ type config struct {
|
||||
OpenImPushPort []int `yaml:"openImPushPort"`
|
||||
OpenImConversationPort []int `yaml:"openImConversationPort"`
|
||||
OpenImCachePort []int `yaml:"openImCachePort"`
|
||||
OpenImRealTimeCommPort []int `yaml:"openImRealTimeCommPort"`
|
||||
OpenImRtcPort []int `yaml:"openImRtcPort"`
|
||||
}
|
||||
RpcRegisterName struct {
|
||||
OpenImUserName string `yaml:"openImUserName"`
|
||||
OpenImFriendName string `yaml:"openImFriendName"`
|
||||
// OpenImOfflineMessageName string `yaml:"openImOfflineMessageName"`
|
||||
OpenImMsgName string `yaml:"openImMsgName"`
|
||||
OpenImPushName string `yaml:"openImPushName"`
|
||||
OpenImRelayName string `yaml:"openImRelayName"`
|
||||
OpenImGroupName string `yaml:"openImGroupName"`
|
||||
OpenImAuthName string `yaml:"openImAuthName"`
|
||||
OpenImConversationName string `yaml:"openImConversationName"`
|
||||
OpenImCacheName string `yaml:"openImCacheName"`
|
||||
OpenImRealTimeCommName string `yaml:"openImRealTimeCommName"`
|
||||
OpenImUserName string `yaml:"openImUserName"`
|
||||
OpenImFriendName string `yaml:"openImFriendName"`
|
||||
OpenImMsgName string `yaml:"openImMsgName"`
|
||||
OpenImPushName string `yaml:"openImPushName"`
|
||||
OpenImMessageGatewayName string `yaml:"openImMessageGatewayName"`
|
||||
OpenImGroupName string `yaml:"openImGroupName"`
|
||||
OpenImAuthName string `yaml:"openImAuthName"`
|
||||
OpenImConversationName string `yaml:"openImConversationName"`
|
||||
OpenImCacheName string `yaml:"openImCacheName"`
|
||||
OpenImRtcName string `yaml:"openImRtcName"`
|
||||
}
|
||||
Zookeeper struct {
|
||||
Schema string `yaml:"schema"`
|
||||
@@ -481,7 +480,7 @@ type config struct {
|
||||
AuthPrometheusPort []int `yaml:"authPrometheusPort"`
|
||||
PushPrometheusPort []int `yaml:"pushPrometheusPort"`
|
||||
ConversationPrometheusPort []int `yaml:"conversationPrometheusPort"`
|
||||
RealTimeCommPrometheusPort []int `yaml:"realTimeCommPrometheusPort"`
|
||||
RtcPrometheusPort []int `yaml:"RtcPrometheusPort"`
|
||||
MessageTransferPrometheusPort []int `yaml:"messageTransferPrometheusPort"`
|
||||
} `yaml:"prometheus"`
|
||||
}
|
||||
|
||||
Vendored
+5
-6
@@ -308,17 +308,16 @@ func (r *RedisClient) HandleSignalInfo(ctx context.Context, operationID string,
|
||||
if err := proto.Unmarshal(msg.Content, req); err != nil {
|
||||
return false, err
|
||||
}
|
||||
//log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "SignalReq: ", req.String())
|
||||
var inviteeUserIDList []string
|
||||
var inviteeUserIDs []string
|
||||
var isInviteSignal bool
|
||||
switch signalInfo := req.Payload.(type) {
|
||||
case *pbRtc.SignalReq_Invite:
|
||||
inviteeUserIDList = signalInfo.Invite.Invitation.InviteeUserIDList
|
||||
inviteeUserIDs = signalInfo.Invite.Invitation.InviteeUserIDList
|
||||
isInviteSignal = true
|
||||
case *pbRtc.SignalReq_InviteInGroup:
|
||||
inviteeUserIDList = signalInfo.InviteInGroup.Invitation.InviteeUserIDList
|
||||
inviteeUserIDs = signalInfo.InviteInGroup.Invitation.InviteeUserIDList
|
||||
isInviteSignal = true
|
||||
if !utils.IsContain(pushToUserID, inviteeUserIDList) {
|
||||
if !utils.IsContain(pushToUserID, inviteeUserIDs) {
|
||||
return false, nil
|
||||
}
|
||||
case *pbRtc.SignalReq_HungUp, *pbRtc.SignalReq_Cancel, *pbRtc.SignalReq_Reject, *pbRtc.SignalReq_Accept:
|
||||
@@ -327,7 +326,7 @@ func (r *RedisClient) HandleSignalInfo(ctx context.Context, operationID string,
|
||||
return false, nil
|
||||
}
|
||||
if isInviteSignal {
|
||||
for _, userID := range inviteeUserIDList {
|
||||
for _, userID := range inviteeUserIDs {
|
||||
timeout, err := strconv.Atoi(config.Config.Rtc.SignalTimeout)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
@@ -93,7 +93,7 @@ func (g *GroupController) DismissGroup(ctx context.Context, groupID string) erro
|
||||
}
|
||||
|
||||
func (g *GroupController) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) {
|
||||
return g.database.
|
||||
return g.database.GetGroupIDsByGroupType(ctx, groupType)
|
||||
}
|
||||
|
||||
func (g *GroupController) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationTb.GroupMemberModel, err error) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db/cache"
|
||||
"context"
|
||||
)
|
||||
|
||||
type PushInterface interface {
|
||||
DelFcmToken(ctx context.Context, userID string, platformID int) error
|
||||
}
|
||||
|
||||
type PushDataBase struct {
|
||||
cache cache.Cache
|
||||
}
|
||||
|
||||
func (p *PushDataBase) DelFcmToken(ctx context.Context, userID string, platformID int) error {
|
||||
return p.cache.DelFcmToken(ctx, userID, platformID)
|
||||
}
|
||||
@@ -25,5 +25,5 @@ func NewConversationLocalCache(client discoveryRegistry.SvcDiscoveryRegistry) Co
|
||||
|
||||
func (g *ConversationLocalCache) GetRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) ([]string, error) {
|
||||
g.client.GetConn()
|
||||
return []string{}
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package localcache
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||
"Open_IM/pkg/discoveryregistry"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"sync"
|
||||
@@ -16,7 +16,7 @@ type GroupLocalCacheInterface interface {
|
||||
type GroupLocalCache struct {
|
||||
lock sync.Mutex
|
||||
cache map[string]GroupMemberIDsHash
|
||||
client discoveryRegistry.SvcDiscoveryRegistry
|
||||
client discoveryregistry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
type GroupMemberIDsHash struct {
|
||||
@@ -24,7 +24,7 @@ type GroupMemberIDsHash struct {
|
||||
userIDs []string
|
||||
}
|
||||
|
||||
func NewGroupMemberIDsLocalCache(client discoveryRegistry.SvcDiscoveryRegistry) *GroupLocalCache {
|
||||
func NewGroupMemberIDsLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *GroupLocalCache {
|
||||
return &GroupLocalCache{
|
||||
cache: make(map[string]GroupMemberIDsHash, 0),
|
||||
client: client,
|
||||
@@ -34,7 +34,7 @@ func NewGroupMemberIDsLocalCache(client discoveryRegistry.SvcDiscoveryRegistry)
|
||||
func (g *GroupLocalCache) GetGroupMemberIDs(ctx context.Context, groupID string) ([]string, error) {
|
||||
g.lock.Lock()
|
||||
defer g.lock.Unlock()
|
||||
conn, err := g.client.GetConn(config.Config.RpcRegisterName.OpenImGroupName, nil)
|
||||
conn, err := g.client.GetConn(config.Config.RpcRegisterName.OpenImGroupName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func Get(url string) (response []byte, err error) {
|
||||
}
|
||||
|
||||
// application/json; charset=utf-8
|
||||
func Post(url string, header map[string]string, data interface{}, timeOutSecond int) (content []byte, err error) {
|
||||
func Post(url string, header map[string]string, data interface{}, timeout int) (content []byte, err error) {
|
||||
jsonStr, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -42,9 +42,12 @@ func Post(url string, header map[string]string, data interface{}, timeOutSecond
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for k, v := range header {
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
req.Close = true
|
||||
req.Header.Add("content-type", "application/json; charset=utf-8")
|
||||
client := &http.Client{Timeout: time.Duration(timeOutSecond) * time.Second}
|
||||
client := &http.Client{Timeout: time.Duration(timeout) * time.Second}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
func StartPromeSrv(promethuesPort int) error {
|
||||
func StartPromeSrv(prometheusPort int) error {
|
||||
if config.Config.Prometheus.Enable {
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
err := http.ListenAndServe(":"+strconv.Itoa(promethuesPort), nil)
|
||||
err := http.ListenAndServe(":"+strconv.Itoa(prometheusPort), nil)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user