events

package
v0.0.0-...-53ca90f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultBase is the default base used to build the URL that a
	// Client is connecting to.
	DefaultBase = "wss://push.planetside2.com/streaming"

	// DefaultEnv is the default environment to connect to.
	DefaultEnv = "ps2"
)

Variables

View Source
var (
	// SubAll is a special value that can be used for any or all of the
	// fields of a Sub as a means of matching all possible values for
	// that field. For example,
	//
	//     Sub{
	//         Events: []string{"BattleRankUp"},
	//         Chars: SubAll,
	//     }
	//
	// will subscribe to level up events for every character.
	SubAll = []string{"all"}
)

Functions

This section is empty.

Types

type AchievementEarned

type AchievementEarned struct {
	CharacterID   int64     `json:"character_id,string"`
	Timestamp     int64     `json:"timestamp,string"`
	WorldID       ps2.World `json:"world_id,string"`
	AchievementID int64     `json:"achievement_id,string"`
	ZoneID        ps2.Zone  `json:"zone_id,string"`
}

type BattleRankUp

type BattleRankUp struct {
	BattleRank  int       `json:"battle_rank,string"`
	CharacterID int64     `json:"character_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
	ZoneID      ps2.Zone  `json:"zone_id,string"`
}

type Client

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

Client is a connection to the Census API event streaming system.

func NewClient

func NewClient(base, env, svcid string) (*Client, error)

NewClient creates a new Client. It connects to the URL at base and the environment env using the service ID svcid. If base or env are the empty string, then DefaultBase and DefaultEnv are used, respectively.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the server. Use of the Client after calling Close may or may not panic.

func (*Client) Conn

func (c *Client) Conn() net.Conn

Conn returns the underlying connection to the server.

func (*Client) Next

func (c *Client) Next() (ev Event, err error)

Next blocks until the next event can be read from the event stream or an error occurs. It then returns that event or the error. If an unsupported event is read, a nil Event and an UnknownEventTypeError are returned.

func (*Client) Subscribe

func (c *Client) Subscribe(sub Sub) error

Subscribe subscribes to the events specified by sub. For more information, see http://census.daybreakgames.com/#websocket-details

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(sub Sub) error

Unsubscribe unsubscribes from the events specified by sub. For more information, see http://census.daybreakgames.com/#websocket-details

type ConnectionStateChanged

type ConnectionStateChanged struct {
	Connected bool `json:"connected,string"`
}

type Death

type Death struct {
	AttackerCharacterID int64     `json:"attacker_character_id,string"`
	AttackerFireModeID  int64     `json:"attacker_fire_mode_id,string"`
	AttackerLoadoutID   int64     `json:"attacker_loadout_id,string"`
	AttackerVehicleID   int64     `json:"attacker_vehicle_id,string"`
	AttackerWeaponID    int64     `json:"attacker_weapon_id,string"`
	CharacterID         int64     `json:"character_id,string"`
	CharacterLoadoutID  int64     `json:"character_loadout_id,string"`
	IsCritical          int       `json:"is_critical,string"`
	IsHeadshot          int       `json:"is_headshot,string"`
	Timestamp           int64     `json:"timestamp,string"`
	VehicleID           int64     `json:"vehicle_id,string"`
	WorldID             ps2.World `json:"world_id,string"`
	ZoneID              ps2.Zone  `json:"zone_id,string"`
}

type Event

type Event interface{}

Event represents a message read from an event stream.

type FacilityControl

type FacilityControl struct {
	DurationHeld int         `json:"duration_held,string"`
	FacilityID   int64       `json:"facility_id,string"`
	NewFactionID ps2.Faction `json:"new_faction_id,string"`
	OldFactionID ps2.Faction `json:"old_faction_id,string"`
	OutfitID     int64       `json:"outfit_id,string"`
	Timestamp    int64       `json:"timestamp,string"`
	WorldID      ps2.World   `json:"world_id,string"`
	ZoneID       ps2.Zone    `json:"zone_id,string"`
}

type GainExperience

type GainExperience struct {
	Amount       int       `json:"amount,string"`
	CharacterID  int64     `json:"character_id,string"`
	ExperienceID int64     `json:"experience_id,string"`
	LoadoutID    int64     `json:"loadout_id,string"`
	OtherID      int64     `json:"other_id,string"`
	Timestamp    int64     `json:"timestamp,string"`
	WorldID      ps2.World `json:"world_id,string"`
	ZoneID       ps2.Zone  `json:"zone_id,string"`
}

type Heartbeat

type Heartbeat struct {
	Briggs  bool `json:"EventServerEndpoint_Briggs_25,string"`
	Cobalt  bool `json:"EventServerEndpoint_Cobalt_13,string"`
	Connery bool `json:"EventServerEndpoint_Connery_1,string"`
	Emerald bool `json:"EventServerEndpoint_Emerald_17,string"`
	Jaeger  bool `json:"EventServerEndpoint_Jaeger_19,string"`
	Miller  bool `json:"EventServerEndpoint_Miller_10,string"`
}

type ItemAdded

type ItemAdded struct {
	CharacterID int64    `json:"character_id,string"`
	Context     string   `json:"context"`
	ItemCount   int      `json:"item_count,string"`
	ItemID      int64    `json:"item_id,string"`
	Timestamp   int64    `json:"timestamp,string"`
	WorldID     int64    `json:"world_id,string"`
	ZoneID      ps2.Zone `json:"zone_id,string"`
}

type PlayerFacilityCapture

type PlayerFacilityCapture struct {
	CharacterID int64     `json:"character_id,string"`
	FacilityID  int64     `json:"facility_id,string"`
	OutfitID    int64     `json:"outfit_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
	ZoneID      ps2.Zone  `json:"zone_id,string"`
}

type PlayerFacilityDefend

type PlayerFacilityDefend struct {
	CharacterID int64     `json:"character_id,string"`
	FacilityID  int64     `json:"facility_id,string"`
	OutfitID    int64     `json:"outfit_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
	ZoneID      ps2.Zone  `json:"zone_id,string"`
}

type PlayerLogin

type PlayerLogin struct {
	CharacterID int64     `json:"character_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
}

type PlayerLogout

type PlayerLogout struct {
	CharacterID int64     `json:"character_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
}

type ServiceStateChanged

type ServiceStateChanged struct {
	Detail string `json:"detail"`
	Online bool   `json:"online,string"`
}

type SkillAdded

type SkillAdded struct {
	CharacterID int64     `json:"character_id,string"`
	SkillID     int64     `json:"skill_id,string"`
	Timestamp   int64     `json:"timestamp,string"`
	WorldID     ps2.World `json:"world_id,string"`
	ZoneID      ps2.Zone  `json:"zone_id,string"`
}

type Sub

type Sub struct {
	Events []string
	Chars  []string
	Worlds []string
}

Sub represents a subscription request.

type UnknownEventTypeError

type UnknownEventTypeError string

UnknownEventTypeError is returned by event stream readers that encountered an event that they didn't know how to handle. The value of the error is set to the string name of the event type.

func (UnknownEventTypeError) Error

func (err UnknownEventTypeError) Error() string

type VehicleDestroy

type VehicleDestroy struct {
	AttackerCharacterID int64       `json:"attacker_character_id,string"`
	AttackerLoadoutID   int64       `json:"attacker_loadout_id,string"`
	AttackerVehicleID   int64       `json:"attacker_vehicle_id,string"`
	AttackerWeaponID    int64       `json:"attacker_weapon_id,string"`
	CharacterID         int64       `json:"character_id,string"`
	FacilityID          int64       `json:"facility_id,string"`
	FactionID           ps2.Faction `json:"faction_id,string"`
	Timestamp           int64       `json:"timestamp,string"`
	VehicleID           int64       `json:"vehicle_id,string"`
	WorldID             ps2.World   `json:"world_id,string"`
	ZoneID              ps2.Zone    `json:"zone_id,string"`
}

Jump to

Keyboard shortcuts

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