Documentation
¶
Index ¶
- Constants
- type ActivityHandle
- type ActivityHandleRelatedInfo
- type Client
- func (c *Client) Activities(ctx context.Context, scid uuid.UUID, opts ...internal.RequestOption) ([]ActivityHandle, error)
- func (c *Client) ActivitiesForUsers(ctx context.Context, scid uuid.UUID, xuids []string, ...) ([]ActivityHandle, error)
- func (c *Client) Close() error
- func (c *Client) CloseContext(ctx context.Context) error
- func (c *Client) Join(ctx context.Context, handleID uuid.UUID, config JoinConfig, ...) (*Session, error)
- func (c *Client) Publish(ctx context.Context, ref SessionReference, config PublishConfig, ...) (*Session, error)
- func (c *Client) SessionByReference(ctx context.Context, ref SessionReference, opts ...internal.RequestOption) (_ *SessionDescription, err error)
- type GameType
- type Handler
- type InviteAttributes
- type InviteHandle
- type JoinConfig
- type MemberConstants
- type MemberConstantsSystem
- type MemberDescription
- type MemberProperties
- type MemberPropertiesSystem
- type MemberPropertiesSystemSubscription
- type NopHandler
- type PublishConfig
- type Session
- func (s *Session) Close() error
- func (s *Session) CloseContext(ctx context.Context) error
- func (s *Session) Constants() SessionConstants
- func (s *Session) Context() context.Context
- func (s *Session) Handle(h Handler)
- func (s *Session) Invite(ctx context.Context, xuid, titleID string, opts ...internal.RequestOption) (*InviteHandle, error)
- func (s *Session) Member(label string) (MemberDescription, bool)
- func (s *Session) MemberByXUID(xuid string) (MemberDescription, bool)
- func (s *Session) Members() iter.Seq2[string, MemberDescription]
- func (s *Session) Properties() SessionProperties
- func (s *Session) Reference() SessionReference
- func (s *Session) SetCustomProperties(ctx context.Context, custom json.RawMessage, opts ...internal.RequestOption) error
- func (s *Session) SetMemberCustomProperties(ctx context.Context, label string, custom json.RawMessage, ...) error
- func (s *Session) Sync(ctx context.Context) error
- type SessionConstants
- type SessionConstantsSystem
- type SessionDescription
- type SessionProperties
- type SessionPropertiesSystem
- type SessionReference
Constants ¶
const ( // SessionRestrictionNone indicates that the session is not visible to anyone. SessionRestrictionNone = "none" // SessionRestrictionLocal indicates that the session is visible only to // users on the same device. // // This restriction is rarely used by online multiplayer titles. SessionRestrictionLocal = "local" // SessionRestrictionFollowed indicates that the session is visible to // local users and users followed by an existing session member. SessionRestrictionFollowed = "followed" )
const ( // ChangeTypeEverything indicates that all changes within the multiplayer session are // delivered to the member over the associated RTA subscription. ChangeTypeEverything = "everything" // ChangeTypeHost indicates that changes to the multiplayer session host // information are delivered to the member over the associated // RTA subscription. ChangeTypeHost = "host" // ChangeTypeInitialization indicates that changes to the session // initialization state are delivered to the member over the associated // RTA subscription. ChangeTypeInitialization = "initialization" // ChangeTypeMatchmakingStatus indicates that changes to the matchmaking // status of the multiplayer session (e.g. match found or match // expired) are delivered to the member over the associated // RTA subscription. ChangeTypeMatchmakingStatus = "matchmakingStatus" // ChangeTypeMembersList indicates that notifications are delivered when a // member joins the multiplayer session. // // This change type is used only to notify member join events. ChangeTypeMembersList = "membersList" // ChangeTypeMembersStatus indicates that notifications are delivered when a // member leaves the multiplayer session. // // This change type is used only to notify member leave events. ChangeTypeMembersStatus = "membersStatus" // ChangeTypeJoinability indicates that changes to the multiplayer session // joinability are delivered to the member over the associated RTA subscription. // // This includes changes to [SessionPropertiesSystem.ReadRestriction] and // [SessionPropertiesSystem.JoinRestriction]. ChangeTypeJoinability = "joinability" // ChangeTypeCustomProperty indicates that changes to the custom properties // of the multiplayer session are delivered to the member over the associated // RTA subscription. ChangeTypeCustomProperty = "customProperty" // ChangeTypeMembersCustomProperty indicates that changes to the custom // properties of any session member are delivered to the member over the // associated RTA subscription. ChangeTypeMembersCustomProperty = "membersCustomProperty" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityHandle ¶
type ActivityHandle struct {
// CreateTime is the time at which the activity handle was created.
CreateTime time.Time `json:"createTime"`
// CustomProperties contains title-defined metadata associated with the
// multiplayer session.
//
// The format and semantics of this field are specific to the title.
CustomProperties json.RawMessage `json:"customProperties"`
// GameTypes is currently unknown and unclear how it is used in retail games.
GameTypes json.RawMessage `json:"gameTypes"`
// ID uniquely identifies the activity handle.
ID uuid.UUID `json:"id"`
// InviteProtocol specifies the protocol used to invite users to the
// multiplayer session.
InviteProtocol string `json:"inviteProtocol"`
// RelatedInfo contains additional state and metadata associated with
// the referenced multiplayer session.
RelatedInfo *ActivityHandleRelatedInfo `json:"relatedInfo"`
// TitleID is the title ID associated with the multiplayer session.
//
// This value may differ from the title of the authenticated client,
// as a single service configuration may be shared across multiple titles.
TitleID string `json:"titleId"`
// OwnerXUID is the XUID of the user who created the multiplayer session.
OwnerXUID string `json:"ownerXuid"`
// contains filtered or unexported fields
}
ActivityHandle represents a published activity handle for a multiplayer session.
An activity handle is created by the session owner to advertise an open multiplayer session and make it discoverable in the session directory.
func (ActivityHandle) URL ¶
func (h ActivityHandle) URL() *url.URL
URL returns the URL locating to the resource for the activity handle.
type ActivityHandleRelatedInfo ¶
type ActivityHandleRelatedInfo struct {
// Closed indicates whether the multiplayer session is closed to new joins.
Closed bool `json:"closed"`
// InviteProtocol specifies the protocol used when inviting the current
// authenticated user.
InviteProtocol string `json:"inviteProtocol"`
// JoinRestriction specifies the restriction applied when joining
// the multiplayer session.
JoinRestriction string `json:"joinRestriction"`
// MaxMembersCount is the maximum number of members allowed in the
// multiplayer session.
MaxMembersCount uint32 `json:"maxMembersCount"`
// PostedTime is the time at which the multiplayer session was created.
PostedTime time.Time `json:"postedTime"`
// Visibility specifies the visibility of the multiplayer session.
Visibility string `json:"visibility"`
}
ActivityHandleRelatedInfo contains additional metadata associated with a multiplayer activity handle.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an API client for Xbox Live's MPSD (Multiplayer Session Directory) API.
func (*Client) Activities ¶
func (c *Client) Activities(ctx context.Context, scid uuid.UUID, opts ...internal.RequestOption) ([]ActivityHandle, error)
Activities returns activity handles for open multiplayer sessions in the specified Service Configuration ID (SCID) for all users.
func (*Client) ActivitiesForUsers ¶
func (c *Client) ActivitiesForUsers(ctx context.Context, scid uuid.UUID, xuids []string, opts ...internal.RequestOption) ([]ActivityHandle, error)
ActivitiesForUsers returns activity handles for open multiplayer sessions associated with the specified XUIDs. The Service Configuration ID (SCID) identifies the game to query. If xuids is nil, it returns all open multiplayer sessions for the SCID.
func (*Client) Close ¶
Close closes the Client with a context of 15 seconds timeout. It unsubscribes from the RTA service if any subscription is present on the Client. It is recommended to use the client-set's github.com/df-mc/go-xsapi.Client.Close method.
func (*Client) CloseContext ¶
CloseContext closes the Client with the context.Context. It unsubscribes from the RTA service if any subscription is present on the Client. It is recommended to use the client-set's github.com/df-mc/go-xsapi.Client.CloseContext method.
func (*Client) Join ¶
func (c *Client) Join(ctx context.Context, handleID uuid.UUID, config JoinConfig, opts ...internal.RequestOption) (*Session, error)
Join joins a multiplayer session in the directory using the provided handle ID.
The handle ID is exposed on several handle types available in the directory, such as:
- ActivityHandle queried by Client.Activities
- InviteHandle sent by Session.Invite and received from notifications.
The provided JoinConfig is applied to the caller's initial member contents. A zero-value JoinConfig may be sufficient for most titles.
A Session may be returned, which represents the joined multiplayer session. Make sure to call Session.Close to leave the session when it is no longer needed.
func (*Client) Publish ¶
func (c *Client) Publish(ctx context.Context, ref SessionReference, config PublishConfig, opts ...internal.RequestOption) (*Session, error)
Publish publishes a new multiplayer session in the directory using the provided SessionReference. The provided PublishConfig is applied to the session's initial contents.
If [SessionReference.Name] is empty, a randomly-generated GUID will be used. Make sure to call Session.Close to close the session when it is no longer needed.
func (*Client) SessionByReference ¶
func (c *Client) SessionByReference(ctx context.Context, ref SessionReference, opts ...internal.RequestOption) (_ *SessionDescription, err error)
SessionByReference looks up for a multiplayer session identified by the reference. If one is found, SessionDescription will be returned, which contains metadata for the multiplayer session which can be used to participate the session in the future. An error is returned, if the context.Context exceeds a deadline, or if the API call was unsuccessful.
type GameType ¶
type GameType struct {
// TitleID is the title ID associated with the game type.
TitleID string `json:"titleId"`
// PackageFamilyName is the package family name associated with the game type.
PackageFamilyName string `json:"pfn"`
// BoundPackageFamilyNames lists other package family names associated with the game type.
BoundPackageFamilyNames []string `json:"boundPfns"`
}
GameType describes a single title available for a specific platform.
type Handler ¶
type Handler interface {
// HandleSessionChange is called when a change is made to a remote session
// in the directory. This includes events such as a member joining the
// session or a custom property being updated. For the full list of changes
// that trigger this handler, refer to the ChangeType* constants defined in
// this package.
HandleSessionChange(session *Session)
}
Handler receives session events delivered over an RTA (Real-Time Activity) subscription. It is primarily used to react to changes made to a remote session in the Multiplayer Session Directory.
A Handler can be registered on a session via Session.Handle. NopHandler provides a no-op implementation of Handler.
type InviteAttributes ¶
type InviteAttributes struct {
// TitleID is the title ID associated with the invite handle.
// For invitation requests, it must be the title authenticated
// by the XSTS token.
TitleID string `json:"titleId"`
// ContextStringID is the optional ID used to activate the
// invite handle. It is unknown how it is used or how it is
// generated during invitation.
ContextStringID string `json:"contextString,omitempty"`
// Context is the optional context associated with the invite
// handle, encapsulated in a string. The format and semantics
// are specific to the title.
Context string `json:"context,omitempty"`
}
InviteAttributes describes attributes associated with the InviteHandle.
type InviteHandle ¶
type InviteHandle struct {
// ID is the unique ID associated with the invite handle.
ID uuid.UUID `json:"id"`
// GameTypes is a map whose keys are platform name such as "uwp-desktop" or
// "android", and whose values are structs that describes a single title
// associated with the invite handle.
GameTypes map[string]GameType `json:"gameTypes"`
// SenderXUID is the XUID of the user that has sent the invite.
SenderXUID string `json:"senderXuid"`
// Expiration indicates the time that this invite handle will expire.
Expiration time.Time `json:"expiration"`
// InviteProtocol is the protocol used for invitation.
// It is unknown how it is used. It is always "game".
// Supported values might also include "party".
InviteProtocol string `json:"inviteProtocol"`
// contains filtered or unexported fields
}
InviteHandle represents a published handle for an invite to a multiplayer session.
An invitation handle is sent by the session participant to the user referenced by XUID.
type JoinConfig ¶
type JoinConfig struct {
// CustomMemberConstants holds immutable constants associated with the caller
// as a member of the session. These are set when joining and cannot be
// changed for the lifetime of the membership.
//
// The format and semantics of this field are defined by the title.
CustomMemberConstants json.RawMessage
// CustomMemberProperties holds mutable properties associated with the caller
// as a member of the session. Unlike [JoinConfig.CustomMemberConstants],
// these can be updated at any time during the session via
// [Session.SetMemberCustomProperties].
//
// The format and semantics of this field are defined by the title.
CustomMemberProperties json.RawMessage
}
JoinConfig describes a configuration for joining a multiplayer session in the directory. It can be passed to Client.Join to customize the join behavior.
type MemberConstants ¶
type MemberConstants struct {
// System contains system-defined constants for the member.
System *MemberConstantsSystem `json:"system,omitempty"`
// Custom contains title-defined constants for the member.
//
// The format and semantics of this field are specific to the title.
Custom json.RawMessage `json:"custom,omitempty"`
}
MemberConstants contains immutable constants for a member in a multiplayer session.
type MemberConstantsSystem ¶
type MemberConstantsSystem struct {
// XUID is the user ID of the member.
XUID string `json:"xuid,omitempty"`
// Initialize indicates whether QoS initialization should be performed for
// the member when joining the session.
Initialize bool `json:"initialize,omitempty"`
}
MemberConstantsSystem specifies the system-specific constants for a member in a multiplayer session.
type MemberDescription ¶
type MemberDescription struct {
// Constants contains immutable, system-defined values
// associated with the member.
//
// Fields in this struct cannot be modified after the member has joined or
// published the multiplayer session.
Constants *MemberConstants `json:"constants,omitempty"`
// Properties contains mutable properties associated with the member.
//
// These properties may be updated at any time, but only by the member
// to whom they belong.
Properties *MemberProperties `json:"properties,omitempty"`
}
MemberDescription describes a member participating in a multiplayer session.
A member description consists of immutable constants, which are fixed once the member joins or publishes the session, and mutable properties, which may be updated over the lifetime of the session by the member themselves.
type MemberProperties ¶
type MemberProperties struct {
// System contains system-defined properties for the member.
System *MemberPropertiesSystem `json:"system,omitempty"`
// Custom contains title-defined properties for the member.
//
// The format and semantics of this field are specific to the title.
Custom json.RawMessage `json:"custom,omitempty"`
}
MemberProperties contains mutable properties for a member in a multiplayer session.
type MemberPropertiesSystem ¶
type MemberPropertiesSystem struct {
// Active indicates whether the member is active in the multiplayer session.
//
// This value is typically true for most members. Joining or publishing a
// multiplayer session requires this field to be set to true.
Active bool `json:"active,omitempty"`
// Ready indicates whether the member is ready for gameplay or matchmaking.
//
// This field is used by titles that support a ready-state concept prior
// to matchmaking or session start.
Ready bool `json:"ready,omitempty"`
// Connection identifies the RTA subscription associated with this member.
//
// The value must match the ID specified in the corresponding
// [rta.Subscription]. Once the member has joined or published the session,
// notifications for the session will be delivered over this connection,
// subject to the scope specified in [MemberPropertiesSystem.Subscription].
Connection uuid.UUID `json:"connection"`
// Subscription specifies which portions of the multiplayer session generate
// notifications over the associated RTA subscription.
Subscription *MemberPropertiesSystemSubscription `json:"subscription,omitempty"`
// SecureDeviceAddress is a legacy identifier used by UWP and Xbox One titles.
//
// The value is base64-encoded and contains device and connection information
// for session hosting. This field is not used by most modern games.
SecureDeviceAddress []byte `json:"secureDeviceAddress,omitempty"`
}
MemberPropertiesSystem defines system-specific, mutable properties for a member in a multiplayer session.
type MemberPropertiesSystemSubscription ¶
type MemberPropertiesSystemSubscription struct {
// ID uniquely identifies the relationship between the RTA subscription
// and the multiplayer session.
//
// The value must be an uppercase UUID (GUID) and is used exclusively
// for this field. It must not be confused with ID, which
// uses a standard (lowercase) UUID format.
ID string `json:"id"`
// ChangeTypes specifies the types of session changes that generate
// notifications for the member over the associated RTA subscription.
ChangeTypes []string `json:"changeTypes,omitempty"`
}
MemberPropertiesSystemSubscription specifies which portions in the multiplayer session that the member is currently in are subject to be notified in the connection between RTA subscriptions.
type NopHandler ¶
type NopHandler struct{}
NopHandler is a no-op implementation of Handler. It is used as the default handler for a Session. A custom implementation can be registered at any time via Session.Handle.
func (NopHandler) HandleSessionChange ¶
func (NopHandler) HandleSessionChange(*Session)
HandleSessionChange implements [Handler.HandleSessionChange].
type PublishConfig ¶
type PublishConfig struct {
// CustomProperties holds mutable properties to be associated with the multiplayer session
// when publishing.
//
// The format and semantics of this field are defined by the title. It is
// commonly used to expose session metadata such as display names or
// server details.
CustomProperties json.RawMessage
// CustomConstants holds immutable constants to be associated with the multiplayer session
// when publishing. Once published, it cannot be changed during for the lifetime of the session.
//
// The format and semantics of this field are defined by the title.
CustomConstants json.RawMessage
// CustomMemberProperties holds mutable properties associated with the host.
// Unlike [JoinConfig.CustomMemberConstants], these can be updated at any time
// during the session via [Session.SetMemberCustomProperties].
//
// The format and semantics of this field are defined by the title.
CustomMemberProperties json.RawMessage
// CustomMemberConstants holds immutable constants associated with the host.
// These are set when publishing and cannot be changed for the lifetime of the ownership.
//
// The format and semantics of this field are defined by the title.
CustomMemberConstants json.RawMessage
// JoinRestriction and ReadRestriction specify who may join or read an open session.
// If JoinRestriction or ReadRestriction are empty, it will default to [SessionRestrictionFollowed].
JoinRestriction, ReadRestriction string
}
PublishConfig describes a configuration for publishing a multiplayer session in the directory. It can be passed to Client.Publish to customize the session's initial contents.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a multiplayer session in MPSD (Multiplayer Session Directory) in Xbox Live.
A Session is a stateful, client-side handle to a remote multiplayer session. It acts as a thin wrapper around a SessionDescription and maintains a locally cached copy of the session state, which is synchronized with MPSD using E-Tags.
In addition to explicit synchronization via Session.Sync, the cached session state is kept up-to-date automatically though an RTA (Real-Time Activity) subscription. RTA delivers session change notifications over a WebSocket connection, allowing the Session to update its cache as soon as the remote multiplayer session changes (e.g. member is joining/leaving).
Session is safe for concurrent use unless otherwise documented.
Once a Session is closed, all operations should be treated as invalid.
func (*Session) Close ¶
Close closes the multiplayer session using a context with 15 seconds timeout.
If the caller is the host of the multiplayer session, the session itself is closed. If the caller is a non-host participant, this call ensures the caller to leave the session.
Once CloseContext succeeds, the multiplayer session will no longer receive notifications about changes in the session even though if the session still exist after leaving. If the remote leave or close request fails, the Session remains usable and CloseContext may be retried.
func (*Session) CloseContext ¶
CloseContext closes the multiplayer session using the context.
If the caller is the host of the multiplayer session, the session itself is closed. If the caller is a non-host participant, this call ensures the caller to leave the session.
Once CloseContext succeeds, the multiplayer session will no longer receive notifications about changes in the session even though if the session still exist after leaving. If the remote leave or close request fails, the Session remains usable and CloseContext may be retried.
func (*Session) Constants ¶
func (s *Session) Constants() SessionConstants
Constants returns the immutable session constants. The returned value is a copy of the cached session state and is safe to modify by the caller.
func (*Session) Context ¶
Context returns a context.Context bound to the lifecycle of the Session. Callers can use this context as the parent context for making calls involving the multiplayer session so they can no longer reference a multiplayer session that is closed.
func (*Session) Handle ¶
Handle registers h as the Handler for this session. The registered handler is called when an event is received over the RTA (Real-Time Activity) subscription, such as when a member joins or leaves the session. Passing nil falls back to NopHandler.
func (*Session) Invite ¶
func (s *Session) Invite(ctx context.Context, xuid, titleID string, opts ...internal.RequestOption) (*InviteHandle, error)
Invite invites the user identified by the XUID to the multiplayer session.
If successful, it returns an InviteHandle describing the created invitation, including service-defined metadata such as the expiration time.
The title ID identifies the title associated with the invite. A title ID is seemingly unique per service configuration and is shared across platforms. For example, PC and Android builds of a cross-platform game use the same title ID. Note that this value is not necessarily the same as the title ID of the currently-authenticated title.
func (*Session) Member ¶
func (s *Session) Member(label string) (MemberDescription, bool)
Member returns the cached description of the member identified by label.
The label corresponds to a member identifier in the session. In addition to concrete member IDs, the special label "me" may be used to refer to the currently authenticated caller participating in the session.
The returned MemberDescription is a copy of the cached state. The boolean result reports whether a non-nil member with the given label exists in the cached session state.
func (*Session) MemberByXUID ¶
func (s *Session) MemberByXUID(xuid string) (MemberDescription, bool)
MemberByXUID returns the cached description of the member identified by their XUID.
The returned MemberDescription is a copy of the cached state. The boolean result reports whether a non-nil member with the given XUID exists in the member list iterator returned from Session.Members.
func (*Session) Members ¶
func (s *Session) Members() iter.Seq2[string, MemberDescription]
Members returns an iterator that yields non-nil members from the cached session state. The returned seq operates over a snapshot of the member map taken at the time of the call, so it is safe to iterate without holding internal locks.
func (*Session) Properties ¶
func (s *Session) Properties() SessionProperties
Properties returns the mutable session properties. The returned value is a copy of the cached session state and is safe to modify by the caller.
func (*Session) Reference ¶
func (s *Session) Reference() SessionReference
Reference returns a reference to the multiplayer session. Callers may use this method for referencing the Session in external services in the game.
func (*Session) SetCustomProperties ¶
func (s *Session) SetCustomProperties(ctx context.Context, custom json.RawMessage, opts ...internal.RequestOption) error
SetCustomProperties commits the custom properties to the multiplayer session. The format or semantics of the custom data is specific to the title. It is commonly used to expose session metadata such as display names or server details.
func (*Session) SetMemberCustomProperties ¶
func (s *Session) SetMemberCustomProperties(ctx context.Context, label string, custom json.RawMessage, opts ...internal.RequestOption) error
SetMemberCustomProperties updates the custom properties of the specified member. The special label "me" refers to the current authenticated caller. Only the owning member may modify their own properties. The context.Context is used for making a PUT request call. Changes are commited immediately and reflected in the local cache.
func (*Session) Sync ¶
Sync reconciles the local session state with the remote session state. In most cases, callers do not need to call Sync explicitly, as the cache is kept up-to-date automatically though RTA subscription. The request uses the current ETag to perform a conditional GET when possible.
type SessionConstants ¶
type SessionConstants struct {
// System contains system-defined constants for the session.
//
// Fields defined by a session template cannot be overridden.
System *SessionConstantsSystem `json:"system,omitempty"`
// Custom contains title-defined constants for the session.
Custom json.RawMessage `json:"custom,omitempty"`
}
SessionConstants contains immutable constants associated with a multiplayer session.
These values may be set by the session author or by the session template defined by the title. Fields in this struct cannot be modified after the session is published.
type SessionConstantsSystem ¶
type SessionConstantsSystem struct {
// MaxMembersCount is the maximum number of members allowed in the session.
MaxMembersCount uint32 `json:"maxMembersCount,omitempty"`
// Capabilities defines the capabilities supported by the session.
//
// The format and semantics of this field are currently undefined.
Capabilities json.RawMessage `json:"capabilities,omitempty"`
// Visibility specifies the visibility level of the session.
Visibility string `json:"visibility,omitempty"`
// Initiators contains the XUIDs of users who initiated the session.
Initiators []string `json:"initiators,omitempty"`
// ReservedRemovalTimeout is the maximum duration, in milliseconds, that a
// reserved member may take to join the session before the reservation
// is removed.
ReservedRemovalTimeout uint64 `json:"reservedRemovalTimeout,omitempty"`
// InactiveRemovalTimeout is the maximum duration, in milliseconds, that an
// inactive member may remain inactive before being removed from the session.
InactiveRemovalTimeout uint64 `json:"inactiveRemovalTimeout,omitempty"`
// ReadyRemovalTimeout is the maximum duration, in milliseconds, that a
// ready member may take to become active before transitioning to inactive.
ReadyRemovalTimeout uint64 `json:"readyRemovalTimeout,omitempty"`
// SessionEmptyTimeout is the maximum duration, in milliseconds, that a
// session may remain empty before being deleted.
SessionEmptyTimeout uint64 `json:"sessionEmptyTimeout,omitempty"`
// Metrics is currently unknown, seems to be used for QoS measurement.
Metrics json.RawMessage `json:"metrics,omitempty"`
// MemberInitialization indicates that members are expected to perform
// initialization after session creation.
//
// Initialization stages and timeouts are tracked automatically, including
// initial Quality of Service (QoS) measurements when metrics are specified.
MemberInitialization json.RawMessage `json:"memberInitialization,omitempty"`
// PeerToPeerRequirements defines QoS requirements for peer-to-peer
// connections between session members.
PeerToPeerRequirements json.RawMessage `json:"peerToPeerRequirements,omitempty"`
// PeerToHostRequirements defines QoS requirements for connections between
// host candidates and session members.
PeerToHostRequirements json.RawMessage `json:"peerToHostRequirements,omitempty"`
// MeasurementServerAddresses contains the server endpoints to be evaluated
// for QoS measurements.
MeasurementServerAddresses json.RawMessage `json:"measurementServerAddresses,omitempty"`
// CloudComputePackage contains Cloud Compute package constants for the session.
CloudComputePackage json.RawMessage `json:"cloudComputePackage,omitempty"`
}
SessionConstantsSystem defines system-specific, immutable constants for a multiplayer session.
type SessionDescription ¶
type SessionDescription struct {
// Constants contains immutable values associated with the multiplayer session.
//
// Fields in this struct cannot be modified after the session is published.
Constants *SessionConstants `json:"constants,omitempty"`
// RoleTypes contains role definitions associated with the session.
//
// The format and semantics of this field are currently undefined.
RoleTypes json.RawMessage `json:"roleTypes,omitempty"`
// Properties contains mutable properties associated with the multiplayer session.
//
// These properties may be updated at any time by the owner of the session.
Properties *SessionProperties `json:"properties,omitempty"`
// Members is a map whose keys are member identifiers (labels) and whose values
// are the corresponding member descriptions.
//
// In addition to concrete numerical IDs for member, the reserved alias "me" may
// be used as a key to refer to the member associated with the currently authenticated user.
//
// A member may modify only their own MemberDescription. Use of "me" is
// equivalent to specifying the caller's own member ID.
Members map[string]*MemberDescription `json:"members,omitempty"`
}
SessionDescription describes a multiplayer session published in the session directory.
A session description consists of immutable constants, mutable properties, and the set of members participating in the session.
type SessionProperties ¶
type SessionProperties struct {
// System contains system-defined properties for the session.
System *SessionPropertiesSystem `json:"system,omitempty"`
// Custom contains title-defined properties for the session.
//
// The format and semantics of this field are defined by the title. It is
// commonly used to expose session metadata such as display names or
// server details.
Custom json.RawMessage `json:"custom,omitempty"`
}
SessionProperties contains mutable properties associated with a multiplayer session.
Unlike SessionConstants, most fields in this struct may be updated over the lifetime of the session by the session owner.
type SessionPropertiesSystem ¶
type SessionPropertiesSystem struct {
// Keywords is an optional list of keywords associated with the session.
Keywords []string `json:"keywords,omitempty"`
// Turn contains the member IDs that currently have the turn in a
// turn-based session. The usage of this field is currently unknown.
Turn []uint32 `json:"turn,omitempty"`
// JoinRestriction specifies who may join an open session.
//
// This field has no effect on reservations and does not apply to
// private or visible sessions.
JoinRestriction string `json:"joinRestriction,omitempty"`
// ReadRestriction specifies who may read an open session before joining.
//
// This field has no effect on reservations and does not apply to
// private or visible sessions.
ReadRestriction string `json:"readRestriction,omitempty"`
// Closed indicates whether the session is joinable.
//
// When true, the session cannot be joined regardless of visibility,
// join restrictions, or available capacity. This field does not
// affect reservations. The default value is false.
Closed bool `json:"closed"`
// Locked indicates whether session membership is locked.
//
// When true, members who leave may rejoin the session, but no new
// members may take their place. The default value is false.
Locked bool `json:"locked,omitempty"`
// Matchmaking is currently unknown, seems to be used for QoS measurement.
Matchmaking json.RawMessage `json:"matchmaking,omitempty"`
// MatchmakingResubmit indicates whether matchmaking should be resubmitted.
//
// When true, a previously found match is considered invalid and must be
// resubmitted. When false, the match is considered successful and the
// matchmaking service may release the session.
MatchmakingResubmit bool `json:"matchmakingResubmit,omitempty"`
// InitializationSucceeded indicates whether session initialization
// completed successfully.
InitializationSucceeded bool `json:"initializationSucceeded,omitempty"`
// Host identifies the device token of the session host.
Host string `json:"host,omitempty"`
// ServerConnectionStringCandidates contains an ordered list of
// case-insensitive connection strings that may be used to connect
// to a game server.
//
// Titles typically use the first entry, but may apply custom selection
// logic (for example, based on load).
ServerConnectionStringCandidates json.RawMessage `json:"serverConnectionStringCandidates,omitempty"`
}
SessionPropertiesSystem defines system-specific, mutable properties for a multiplayer session.
type SessionReference ¶
type SessionReference struct {
// ServiceConfigID is the Xbox Live service configuration ID (SCID)
// associated with the title.
//
// A single service configuration may be shared by multiple titles
// and platforms for the same game.
ServiceConfigID uuid.UUID `json:"scid,omitempty"`
// TemplateName is the name of the session template used to create
// the session.
//
// This value may be used to retrieve the template definition via
// API.TemplateByName.
TemplateName string `json:"templateName,omitempty"`
// Name is the unique identifier of the session.
//
// The value is an uppercase UUID (GUID) that uniquely identifies
// the session within the service configuration.
Name string `json:"name,omitempty"`
}
SessionReference encapsulates a reference to a multiplayer session.
func (SessionReference) URL ¶
func (ref SessionReference) URL() *url.URL
URL returns the URL locating to the HTTP resource of the session.