gcm

package module
v0.0.0-...-e7e7c92 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2015 License: MIT Imports: 10 Imported by: 0

README

go-gcm-ccs

Go implementation of GCM Cloud Connection Server using XMPP

Documentation

Index

Constants

View Source
const (
	ACK      = "ack"
	NACK     = "nack"
	CONTROL  = "control"
	RECEIPT  = "receipt"
	UPSTREAM = ""
)
View Source
const (
	START_STREAM = `` /* 136-byte string literal not displayed */

	CLIENT_AUTH = `<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">%s</auth>`

	IQ_BIND_REQUEST = `<iq type="set" id="%s"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"></bind></iq>\n`
)
View Source
const (
	XML_STREAM_NAMESPACE  = "http://etherx.jabber.org/streams"
	XML_STREAM_LOCAL_NAME = "stream"

	XML_SASL_NAMESPACE = "urn:ietf:params:xml:ns:xmpp-sasl"
	XML_SASL_SUCCESS   = "success"
)
View Source
const (
	CCS_MESSAGE = `<message id="%s"><gcm xmlns="google:mobile:data">%s</gcm></message>`
)
View Source
const (
	TCP = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACKMessage

type ACKMessage struct {
	To          string `json:"to"`
	MessageID   string `json:"message_id"`
	MessageType string `json:"message_type"`
}

type CCSClient

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

func (*CCSClient) Close

func (this *CCSClient) Close() (err error)

func (*CCSClient) Init

func (this *CCSClient) Init(tlsConfig *tls.Config, config Config) (err error)

func (*CCSClient) Recv

func (this *CCSClient) Recv() (*CCSMessageResponse, error)

func (*CCSClient) Send

func (this *CCSClient) Send(messageID string, messageContent string) (err error)

type CCSMessageResponse

type CCSMessageResponse struct {
	MessageType      string      `json:"message_type"`
	ControlType      string      `json:"control_type"`
	MessageID        string      `json:"message_id"`
	From             string      `json:"from"`
	Data             interface{} `json:"data"`
	Category         string      `json:"category"`
	Error            string      `json:"error"`
	ErrorDescription string      `json:"error_description"`
}

type Config

type Config struct {
	Host string
	Port string
	//GCM API Key
	Username string
	//GCM Project Number
	Password string
}

func (Config) FullAddress

func (this Config) FullAddress() string

func (Config) GetEncodedKey

func (this Config) GetEncodedKey() string

type GCMClient

type GCMClient struct {
	CCSClient *CCSClient
}

func (*GCMClient) NewClient

func (this *GCMClient) NewClient(config Config) (client *CCSClient, err error)

type Message

type Message struct {
	To                       string      `json:"to"`
	MessageID                string      `json:"message_id"`
	Data                     interface{} `json:"data"`
	TTL                      int64       `json:"time_to_live"`
	DelayWhileIdle           bool        `json:"delay_while_idle"`
	DeliveryReceiptRequested bool        `json:"delivery_receipt_requested"`
}

type ReceiptMessage

type ReceiptMessage struct {
	MessageStatus        string `json:"message_status"`
	OriginalMessageID    string `json:"original_message_id"`
	DeviceRegistrationID string `json:"device_registration_id"`
}

Jump to

Keyboard shortcuts

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