Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultUserAgent

func DefaultUserAgent() string

Types

type Caller

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

func NewCaller

func NewCaller() *Caller

func (*Caller) Call

func (c *Caller) Call(params *Props, payload *Payload) (events *Events, err error)

func (*Caller) SetAddress

func (c *Caller) SetAddress(address string)

func (*Caller) SetHeader

func (c *Caller) SetHeader(key, value string)

type CloseHandler

type CloseHandler interface {
	OnClose()
}

type ConnActiveHandler

type ConnActiveHandler interface {
	OnConnActive()
}

type ConnStateHandler

type ConnStateHandler interface {
	OnConnState(state string)
}

type Event

type Event ninchat.Event

func (*Event) GetParams

func (e *Event) GetParams() *Props

func (*Event) GetPayload

func (e *Event) GetPayload() *Payload

func (*Event) String

func (e *Event) String() string

type EventHandler

type EventHandler interface {
	OnEvent(params *Props, payload *Payload, lastReply bool)
}

type Events

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

func (*Events) Get

func (es *Events) Get(i int) *Event

func (*Events) Length

func (es *Events) Length() int

func (*Events) String

func (es *Events) String() string

type JSON

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

func NewJSON

func NewJSON(s string) *JSON

type LogHandler

type LogHandler interface {
	OnLog(msg string)
}

type Objects

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

func (*Objects) Get

func (os *Objects) Get(i int) *Props

func (*Objects) Length

func (os *Objects) Length() int

func (*Objects) String

func (os *Objects) String() string

type Payload

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

func NewPayload

func NewPayload() *Payload

func (*Payload) Append

func (p *Payload) Append(blob []byte)

func (*Payload) Get

func (p *Payload) Get(i int) []byte

func (*Payload) Length

func (p *Payload) Length() int

func (*Payload) String

func (p *Payload) String() string

type PropVisitor

type PropVisitor interface {
	VisitBool(string, bool) error
	VisitNumber(string, float64) error
	VisitString(string, string) error
	VisitStringArray(string, *Strings) error
	VisitObject(string, *Props) error
	VisitObjectArray(string, *Objects) error
}

type Props

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

func NewProps

func NewProps() *Props

func (*Props) Accept

func (ps *Props) Accept(callback PropVisitor) (err error)

func (*Props) EncryptToJWT

func (ps *Props) EncryptToJWT(key, secret string) (string, error)

func (*Props) GetBool

func (ps *Props) GetBool(key string) (val bool, err error)

func (*Props) GetFloat

func (ps *Props) GetFloat(key string) (val float64, err error)

func (*Props) GetInt

func (ps *Props) GetInt(key string) (val int, err error)

func (*Props) GetObject

func (ps *Props) GetObject(key string) (ref *Props, err error)

func (*Props) GetObjectArray

func (ps *Props) GetObjectArray(key string) (ref *Objects, err error)

func (*Props) GetString

func (ps *Props) GetString(key string) (val string, err error)

func (*Props) GetStringArray

func (ps *Props) GetStringArray(key string) (ref *Strings, err error)

func (*Props) MarshalJSON

func (ps *Props) MarshalJSON() (string, error)

func (*Props) SetBool

func (ps *Props) SetBool(key string, val bool)

func (*Props) SetFloat

func (ps *Props) SetFloat(key string, val float64)

func (*Props) SetInt

func (ps *Props) SetInt(key string, val int)

func (*Props) SetJSON

func (ps *Props) SetJSON(key string, ref *JSON)

func (*Props) SetObject

func (ps *Props) SetObject(key string, ref *Props)

func (*Props) SetString

func (ps *Props) SetString(key string, val string)

func (*Props) SetStringArray

func (ps *Props) SetStringArray(key string, ref *Strings)

func (*Props) String

func (ps *Props) String() string

func (*Props) UnmarshalJSON

func (ps *Props) UnmarshalJSON(data string) error

type Session

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

func NewSession

func NewSession() (s *Session)

func (*Session) Close

func (s *Session) Close()

func (*Session) Open

func (s *Session) Open() (err error)

func (*Session) Send

func (s *Session) Send(params *Props, payload *Payload) (actionId int64, err error)

func (*Session) SetAddress

func (s *Session) SetAddress(address string)

func (*Session) SetDisableLongPoll

func (s *Session) SetDisableLongPoll(disabled bool)

func (*Session) SetHeader

func (s *Session) SetHeader(key, value string)

func (*Session) SetOnClose

func (s *Session) SetOnClose(h CloseHandler)

func (*Session) SetOnConnActive

func (s *Session) SetOnConnActive(h ConnActiveHandler)

func (*Session) SetOnConnState

func (s *Session) SetOnConnState(h ConnStateHandler)

func (*Session) SetOnEvent

func (s *Session) SetOnEvent(h EventHandler)

func (*Session) SetOnLog

func (s *Session) SetOnLog(h LogHandler)

func (*Session) SetOnSessionEvent

func (s *Session) SetOnSessionEvent(h SessionEventHandler)

func (*Session) SetParams

func (s *Session) SetParams(params *Props) (err error)

type SessionEventHandler

type SessionEventHandler interface {
	OnSessionEvent(params *Props)
}

type Strings

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

func NewStrings

func NewStrings() *Strings

func (*Strings) Append

func (ss *Strings) Append(val string)

func (*Strings) Get

func (ss *Strings) Get(i int) string

func (*Strings) Length

func (ss *Strings) Length() int

func (*Strings) String

func (ss *Strings) String() string

Source Files