protocol

package
v0.0.0-...-b2761b6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2014 License: GPL-3.0, GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package protocol has code to talk the client-daemon<->push-server protocol.

Index

Constants

View Source
const ProtocolWireVersion = 0
View Source
const SystemChannelId = "0"

System channel id using a shortened hex encoded form for the NIL UUID

Variables

This section is empty.

Functions

func ReadWireFormatVersion

func ReadWireFormatVersion(conn net.Conn, exchangeTimeout time.Duration) (ver int, err error)

Types

type AckMsg

type AckMsg struct {
	Type string `json:"T"`
}

ACKnowelgement message

type BroadcastMsg

type BroadcastMsg struct {
	Type     string `json:"T"`
	AppId    string `json:",omitempty"`
	ChanId   string
	TopLevel int64
	Payloads []json.RawMessage
	// contains filtered or unexported fields
}

BROADCAST messages

func (*BroadcastMsg) Split

func (m *BroadcastMsg) Split() bool

type ConnAckMsg

type ConnAckMsg struct {
	Type   string `json:"T"`
	Params ConnAckParams
}

CONNACK message

type ConnAckParams

type ConnAckParams struct {
	// ping interval formatted time.Duration
	PingInterval string
}

ConnAckParams carries the connection parameters from the server on connection acknowledment.

type ConnectMsg

type ConnectMsg struct {
	Type      string `json:"T"`
	ClientVer string
	DeviceId  string
	Info      map[string]interface{} `json:",omitempty"` // platform etc...
	// maps channel ids (hex encoded UUIDs) to known client channel levels
	Levels map[string]int64
}

CONNECT message

type Notification

type Notification struct {
	AppId string `json:"A"`
	MsgId string `json:"M"`
	// payload
	Payload json.RawMessage `json:"P"`
}

A single unicast notification

type NotificationsMsg

type NotificationsMsg struct {
	Type          string `json:"T"`
	Notifications []Notification
}

NOTIFICATIONS message

type PingPongMsg

type PingPongMsg struct {
	Type string `json:"T"`
}

PING/PONG messages

type Protocol

type Protocol interface {
	SetDeadline(t time.Time)
	ReadMessage(msg interface{}) error
	WriteMessage(msg interface{}) error
}

Protocol is a connection capable of writing and reading the wire format of protocol messages.

func NewProtocol0

func NewProtocol0(conn net.Conn) Protocol

NewProtocol0 creates and initialises a protocol with wire format version 0.

type SplittableMsg

type SplittableMsg interface {
	Split() (done bool)
}

SplittableMsg are messages that may require and are capable of splitting.

Jump to

Keyboard shortcuts

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