Documentation ¶
Index ¶
- Constants
- Variables
- type AchievementEarned
- type BattleRankUp
- type Client
- type ConnectionStateChanged
- type Death
- type Event
- type FacilityControl
- type GainExperience
- type Heartbeat
- type ItemAdded
- type PlayerFacilityCapture
- type PlayerFacilityDefend
- type PlayerLogin
- type PlayerLogout
- type ServiceStateChanged
- type SkillAdded
- type Sub
- type UnknownEventTypeError
- type VehicleDestroy
Constants ¶
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 ¶
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 BattleRankUp ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to the Census API event streaming system.
func NewClient ¶
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 ¶
Close closes the connection to the server. Use of the Client after calling Close may or may not panic.
func (*Client) Next ¶
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 ¶
Subscribe subscribes to the events specified by sub. For more information, see http://census.daybreakgames.com/#websocket-details
func (*Client) Unsubscribe ¶
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 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 PlayerFacilityDefend ¶
type PlayerLogin ¶
type PlayerLogout ¶
type ServiceStateChanged ¶
type SkillAdded ¶
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"` }