webhook

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const EventMsgNotify = "msg.notify"

EventMsgNotify 消息通知 (所有消息)

View Source
const EventMsgOffline = "msg.offline"

EventMsgOffline 离线消息

View Source
const EventOnlineStatus = "user.onlinestatus"

EventOnlineStatus 在线状态

Variables

This section is empty.

Functions

This section is empty.

Types

type APNS

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

APNS APNS

func NewAPNS

func NewAPNS(p12FilePath, password string, dev bool) *APNS

NewAPNS NewAPNS

func (*APNS) Push

func (a *APNS) Push(notification *apns2.Notification) error

Push 推送消息

type BasePayload

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

BasePayload 基础负载

func (*BasePayload) GetBadge

func (p *BasePayload) GetBadge() int

GetBadge 推送红点

func (*BasePayload) GetContent

func (p *BasePayload) GetContent() string

GetContent 推送正文

func (*BasePayload) GetRTCPayload

func (p *BasePayload) GetRTCPayload() RTCPayload

func (*BasePayload) GetTitle

func (p *BasePayload) GetTitle() string

GetTitle 推送标题

type BaseRTCPayload

type BaseRTCPayload struct {
	BasePayload
	// contains filtered or unexported fields
}

func (*BaseRTCPayload) GetCallType

func (b *BaseRTCPayload) GetCallType() common.RTCCallType

func (*BaseRTCPayload) GetFromUID

func (b *BaseRTCPayload) GetFromUID() string

func (*BaseRTCPayload) GetOperation

func (b *BaseRTCPayload) GetOperation() string

func (*BaseRTCPayload) GetRTCPayload

func (b *BaseRTCPayload) GetRTCPayload() RTCPayload

type ChannelReq

type ChannelReq struct {
	ChannelID   string `json:"channel_id"`
	ChannelType uint8  `json:"channel_type"`
}

type DB

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

DB DB

func NewDB

func NewDB(session *dbr.Session) *DB

NewDB NewDB

func (*DB) GetGroupName

func (db *DB) GetGroupName(groupNo string) (string, error)

GetGroupName 获取群名

func (*DB) GetThirdName

func (db *DB) GetThirdName(fromUID string, toUID string, groupNo string) (string, string, string, error)

GetThirdName 获取三个名字 (常用名字,好友备注,群内名字) (TODO: 此方法不应该直接写sql 应该调用各模块的server来获取数据)

type Event

type Event struct {
	Event string      `json:"event"` // 事件标示
	Data  interface{} `json:"data"`  // 事件数据
}

Event Event

type HMSPayload

type HMSPayload struct {
	Payload
	// contains filtered or unexported fields
}

HMSPayload 华为负载

func NewHMSPayload

func NewHMSPayload(payloadInfo *PayloadInfo, accessToken string) *HMSPayload

NewHMSPayload NewHMSPayload

type HMSPush

type HMSPush struct {
	log.Log
	// contains filtered or unexported fields
}

HMSPush 华为推送

func NewHMSPush

func NewHMSPush(appID string, appSecret string, packageName string) *HMSPush

NewHMSPush NewHMSPush

func (*HMSPush) GetHMSAccessToken

func (h *HMSPush) GetHMSAccessToken() (string, time.Duration, error)

GetHMSAccessToken 获取华为的访问Token

func (*HMSPush) GetPayload

func (h *HMSPush) GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)

GetPayload 获取推送负载

func (*HMSPush) Push

func (h *HMSPush) Push(deviceToken string, payload Payload) error

Push 推送

type IOSPayload

type IOSPayload struct {
	Payload
}

IOSPayload iOS负载

type IOSPush

type IOSPush struct {
	log.Log
	// contains filtered or unexported fields
}

IOSPush IOSPush

func NewIOSPush

func NewIOSPush(topic string, dev bool, p12FilePath string, password string) *IOSPush

NewIOSPush NewIOSPush

func (*IOSPush) GetPayload

func (p *IOSPush) GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)

GetPayload 获取推送负载

func (*IOSPush) Push

func (p *IOSPush) Push(deviceToken string, payload Payload) error

Push iOS推送

type MIPayload

type MIPayload struct {
	Payload
	// contains filtered or unexported fields
}

MIPayload 小米负载

func NewMIPayload

func NewMIPayload(payloadInfo *PayloadInfo, notifyID string) *MIPayload

NewMIPayload NewMIPayload

type MIPush

type MIPush struct {
	log.Log
	// contains filtered or unexported fields
}

MIPush 小米推送

func NewMIPush

func NewMIPush(appID string, appSecret string, packageName string, channelID string) *MIPush

NewMIPush NewMIPush

func (*MIPush) GetPayload

func (m *MIPush) GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)

GetPayload 获取推送负载

func (*MIPush) Push

func (m *MIPush) Push(deviceToken string, payload Payload) error

Push 推送

type MsgResp

type MsgResp struct {
	Header      messageHeader `json:"header"`  // 消息头部
	Setting     uint8         `json:"setting"` // setting
	ClientMsgNo string        `json:"client_msg_no"`
	MessageID   int64         `json:"message_id"`   // 服务端的消息ID(全局唯一)
	MessageSeq  uint32        `json:"message_seq"`  // 消息序列号 (用户唯一,有序递增)
	FromUID     string        `json:"from_uid"`     // 发送者UID
	ToUID       string        `json:"to_uid"`       // 接受者uid
	ChannelID   string        `json:"channel_id"`   // 频道ID
	ChannelType uint8         `json:"channel_type"` // 频道类型
	Expire      uint32        `json:"expire"`       // 消息过期时间(单位秒)
	Timestamp   int32         `json:"timestamp"`    // 服务器消息时间戳(10位,到秒)
	Payload     []byte        `json:"payload"`      // 消息内容
	ContentType int           // 消息正文类型
	PayloadMap  map[string]interface{}
}

MsgResp MsgResp

type OPPOPayload

type OPPOPayload struct {
	Payload
	// contains filtered or unexported fields
}

OPPOPayload oppo负载

func NewOPPOPayload

func NewOPPOPayload(payloadInfo *PayloadInfo, notifyID string) *OPPOPayload

NewOPPOPayload NewOPPOPayload

type OPPOPush

type OPPOPush struct {
	log.Log
	// contains filtered or unexported fields
}

OPPO 推送

func NewOPPOPush

func NewOPPOPush(appID, appKey, appSecret, masterSecret string, ctx *config.Context) *OPPOPush

NewOPPOPush NewOPPOPush

func (*OPPOPush) GetPayload

func (o *OPPOPush) GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)

GetPayload GetPayload

func (*OPPOPush) Push

func (o *OPPOPush) Push(deviceToken string, payload Payload) error

Push Push

func (*OPPOPush) SHA256

func (o *OPPOPush) SHA256(password string) string

type Payload

type Payload interface {
	GetTitle() string   // 推送标题
	GetContent() string // 推送正文
	GetBadge() int      // 推送红点

	GetRTCPayload() RTCPayload // 获取rtc的payload
}

Payload 推送内容

func NewIOSPayload

func NewIOSPayload(payloadInfo *PayloadInfo) Payload

NewIOSPayload NewIOSPayload

type PayloadInfo

type PayloadInfo struct {
	Title   string
	Content string
	Badge   int

	// ------ 以下是rtc推送需要 ------
	IsVideoCall bool   // 是否是rtc消息
	FromUID     string // rtc消息需要
	CallType    common.RTCCallType
	Operation   string
}

func ParsePushInfo

func ParsePushInfo(msgResp msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (*PayloadInfo, error)

ParsePushInfo 解析推送信息 获得title,content,badge

type Push

type Push interface {
	GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)
	Push(deviceToken string, payload Payload) error
}

Push Push

type RTCPayload

type RTCPayload interface {
	GetCallType() common.RTCCallType // 音视频呼叫类型
	GetOperation() string            // 音视频操作 invite: 邀请音视频 cancel:取消邀请
	GetFromUID() string              // 发起人的uid
}

type VIVOPayload

type VIVOPayload struct {
	Payload
	// contains filtered or unexported fields
}

VIVOPayload VIVO负载

func NewVIVOPayload

func NewVIVOPayload(payloadInfo *PayloadInfo, notifyID string) *VIVOPayload

NewVIVOPayload NewVIVOPayload

type VIVOPush

type VIVOPush struct {
	log.Log
	// contains filtered or unexported fields
}

VIVO 推送

func NewVIVOPush

func NewVIVOPush(appID, appKey, appSecret string, ctx *config.Context) *VIVOPush

NewVIVOPush NewVIVOPush

func (*VIVOPush) GetPayload

func (v *VIVOPush) GetPayload(msg msgOfflineNotify, ctx *config.Context, toUser *user.Resp) (Payload, error)

GetPayload GetPayload

func (*VIVOPush) Push

func (v *VIVOPush) Push(deviceToken string, payload Payload) error

Push Push

type Webhook

type Webhook struct {
	log.Log

	wkhook.UnimplementedWebhookServiceServer
	// contains filtered or unexported fields
}

Webhook Webhook

func New

func New(ctx *config.Context) *Webhook

New New

func (*Webhook) Route

func (w *Webhook) Route(r *wkhttp.WKHttp)

Route 路由配置

func (*Webhook) SendWebhook

func (w *Webhook) SendWebhook(ctx context.Context, req *wkhook.EventReq) (*wkhook.EventResp, error)

func (*Webhook) Start

func (w *Webhook) Start() error

func (*Webhook) Stop

func (w *Webhook) Stop() error

Jump to

Keyboard shortcuts

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