Documentation ¶
Index ¶
- Constants
- Variables
- func AuthorizeV2(connId bson.ObjectId, userId, userAgent, IP string) *sdk.APIResponse
- func CreateNewMessage(topic enum.TopicEnumValue, toUserId string, content *model.Content) *sdk.APIResponse
- func DecryptMsg(msg []byte, key *rsa.PrivateKey) string
- func FirebaseMessageQueueDBConsumer(item *sdk.QueueItem) error
- func GetActiveConnectionOfUser(userId string) *sdk.APIResponse
- func GetReceiverId(users []string, sender string) string
- func InitDeviceRegistrationDB(dbSession *sdk.DBSession, dbName string)
- func InitFirebaseMessageQueueDB(dbSession *sdk.DBSession, dbName string)
- func IsExist(arr []string, e string) bool
- func IsValidTopic(input enum.TopicEnumValue) bool
- func PushMessageToDevice(conn *websocket.Connection, message string, messageId *bson.ObjectId) error
- func QueueConsume(item *sdk.SortedQueueItem) error
- func RemoveUser(arr []string, e string) []string
- func TryToCleanConnection()
- type ConQuery
- type DeviceRegistration
- type FirebaseClient
- func (c *FirebaseClient) Send(msg ...FirebaseMessages) (*FirebaseResponse, error)
- func (c *FirebaseClient) WithCollapseKey(k string) FirebaseMessages
- func (c *FirebaseClient) WithCondition(cd string) FirebaseMessages
- func (c *FirebaseClient) WithContentAvailable(b bool) FirebaseMessages
- func (c *FirebaseClient) WithData(d map[string]interface{}) FirebaseMessages
- func (c *FirebaseClient) WithDelay(b bool) FirebaseMessages
- func (c *FirebaseClient) WithDeliveryReceiptRequested(b bool) FirebaseMessages
- func (c *FirebaseClient) WithDryRun(b bool) FirebaseMessages
- func (c *FirebaseClient) WithMutableContent(b bool) FirebaseMessages
- func (c *FirebaseClient) WithNotification(nf *FirebaseNotification) FirebaseMessages
- func (c *FirebaseClient) WithPriority(p string) FirebaseMessages
- func (c *FirebaseClient) WithRegistrationIDs(ids []string) FirebaseMessages
- func (c *FirebaseClient) WithRestrictedPackageName(r string) FirebaseMessages
- func (c *FirebaseClient) WithTimeToLive(t time.Duration) FirebaseMessages
- func (c *FirebaseClient) WithToken(t string) FirebaseMessages
- type FirebaseMessages
- type FirebaseNotification
- type FirebaseResponse
- type Result
Constants ¶
View Source
const Limit = 100
View Source
const Url = "https://fcm.googleapis.com/fcm/send"
Variables ¶
View Source
var CONNECTED_TIME = "connectedTime"
View Source
var DeviceRegistrationDB = &sdk.DBModel2{ ColName: "firebase_registration", TemplateObject: &DeviceRegistration{}, }
View Source
var FirebaseMessageQueueDB = sdk.DBQueue2{
ColName: "firebase_message_queue",
}
View Source
var USER_CON_ID = "userConId"
View Source
var USER_ID = "userId"
Functions ¶
func AuthorizeV2 ¶
func AuthorizeV2(connId bson.ObjectId, userId, userAgent, IP string) *sdk.APIResponse
func CreateNewMessage ¶
func CreateNewMessage(topic enum.TopicEnumValue, toUserId string, content *model.Content) *sdk.APIResponse
func DecryptMsg ¶
func DecryptMsg(msg []byte, key *rsa.PrivateKey) string
func GetActiveConnectionOfUser ¶
func GetActiveConnectionOfUser(userId string) *sdk.APIResponse
func GetReceiverId ¶
func IsValidTopic ¶
func IsValidTopic(input enum.TopicEnumValue) bool
func PushMessageToDevice ¶
func QueueConsume ¶
func QueueConsume(item *sdk.SortedQueueItem) error
func RemoveUser ¶
func TryToCleanConnection ¶
func TryToCleanConnection()
Types ¶
type ConQuery ¶
type ConQuery struct { Status enum.ConStatusEnumValue `bson:"status"` LastMessageTime map[string]*time.Time `bson:"last_message_time"` }
type DeviceRegistration ¶
type FirebaseClient ¶
type FirebaseClient struct {
// contains filtered or unexported fields
}
func GetDefaultFirebaseClient ¶
func GetDefaultFirebaseClient() (*FirebaseClient, error)
func NewClient ¶
func NewClient(apiKey, endPoint string, timeout time.Duration) (*FirebaseClient, error)
func NewClientDefault ¶
func NewClientDefault(apiKey string) (*FirebaseClient, error)
func (*FirebaseClient) Send ¶
func (c *FirebaseClient) Send(msg ...FirebaseMessages) (*FirebaseResponse, error)
Send is func client send msg to server
func (*FirebaseClient) WithCollapseKey ¶
func (c *FirebaseClient) WithCollapseKey(k string) FirebaseMessages
func (*FirebaseClient) WithCondition ¶
func (c *FirebaseClient) WithCondition(cd string) FirebaseMessages
func (*FirebaseClient) WithContentAvailable ¶
func (c *FirebaseClient) WithContentAvailable(b bool) FirebaseMessages
func (*FirebaseClient) WithData ¶
func (c *FirebaseClient) WithData(d map[string]interface{}) FirebaseMessages
func (*FirebaseClient) WithDelay ¶
func (c *FirebaseClient) WithDelay(b bool) FirebaseMessages
func (*FirebaseClient) WithDeliveryReceiptRequested ¶
func (c *FirebaseClient) WithDeliveryReceiptRequested(b bool) FirebaseMessages
func (*FirebaseClient) WithDryRun ¶
func (c *FirebaseClient) WithDryRun(b bool) FirebaseMessages
func (*FirebaseClient) WithMutableContent ¶
func (c *FirebaseClient) WithMutableContent(b bool) FirebaseMessages
func (*FirebaseClient) WithNotification ¶
func (c *FirebaseClient) WithNotification(nf *FirebaseNotification) FirebaseMessages
func (*FirebaseClient) WithPriority ¶
func (c *FirebaseClient) WithPriority(p string) FirebaseMessages
func (*FirebaseClient) WithRegistrationIDs ¶
func (c *FirebaseClient) WithRegistrationIDs(ids []string) FirebaseMessages
func (*FirebaseClient) WithRestrictedPackageName ¶
func (c *FirebaseClient) WithRestrictedPackageName(r string) FirebaseMessages
func (*FirebaseClient) WithTimeToLive ¶
func (c *FirebaseClient) WithTimeToLive(t time.Duration) FirebaseMessages
func (*FirebaseClient) WithToken ¶
func (c *FirebaseClient) WithToken(t string) FirebaseMessages
type FirebaseMessages ¶
type FirebaseMessages interface {
// contains filtered or unexported methods
}
type FirebaseNotification ¶
type FirebaseNotification struct { Title string `json:"title,omitempty"` Body string `json:"body,omitempty"` ChannelID string `json:"android_channel_id,omitempty"` Icon string `json:"icon,omitempty"` Sound string `json:"sound,omitempty"` Badge string `json:"badge,omitempty"` Tag string `json:"tag,omitempty"` Color string `json:"color,omitempty"` ClickAction string `json:"click_action,omitempty"` }
type FirebaseResponse ¶
type FirebaseResponse struct { MulticastID int64 `json:"multicast_id"` Success int `json:"success"` Failure int `json:"failure"` CanonicalIDs int `json:"canonical_ids"` Results []Result `json:"results"` // Device Group HTTP Response FailedRegistrationIDs []string `json:"failed_registration_ids"` // Topic HTTP response MessageID int64 `json:"message_id"` Error error `json:"error"` }
Click to show internal directories.
Click to hide internal directories.