Edit

Share via


MultiplayerService.TryWriteSessionAsync Method

Definition

Attempts to write a new or updated multiplayer session to the service. The passed multiplayerSession must have a valid MultiplayerSessionReference set on it. The purpose of this method is to give the caller additional details on the failure or success of the operation.

This method returns a WriteSessionResult instead of throwing an exception, but only in cases where the write failed for a reason that is expected to occur during normal operation.

public Windows.Foundation.IAsyncOperation<Microsoft.Xbox.Services.Multiplayer.WriteSessionResult> TryWriteSessionAsync (Microsoft.Xbox.Services.Multiplayer.MultiplayerSession multiplayerSession, Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionWriteMode multiplayerSessionWriteMode);
abstract member TryWriteSessionAsync : Microsoft.Xbox.Services.Multiplayer.MultiplayerSession * Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionWriteMode -> Windows.Foundation.IAsyncOperation<Microsoft.Xbox.Services.Multiplayer.WriteSessionResult>
override this.TryWriteSessionAsync : Microsoft.Xbox.Services.Multiplayer.MultiplayerSession * Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionWriteMode -> Windows.Foundation.IAsyncOperation<Microsoft.Xbox.Services.Multiplayer.WriteSessionResult>

Parameters

multiplayerSession
MultiplayerSession

A MultiplayerSession object that has been modified with the changes to write.

multiplayerSessionWriteMode
MultiplayerSessionWriteMode

An enumeration value indicating the type of write operation.

Returns

Windows.Foundation.IAsyncOperation<WriteSessionResult>

Returns an IAsyncOperation<TResult> object that represents the state of the asynchronous operation. Completion of the asynchronous operation is signaled by using a handler that is passed to the IAsyncOperation<TResult>.Completed property. When the asynchronous operation is complete, the result of the operation can be retrieved by using the IAsyncOperation<TResult>.GetResults method.

The result is an object representing a WriteSessionResult object that contains the response returned from the server, a status with the result, as well as if the status was successful. The attributes in it may be different from the attributes in the passed in MultiplayerSessionRequest object.

Implements

Microsoft.Xbox.Services.Multiplayer.__IMultiplayerServicePublicNonVirtuals.TryWriteSessionAsync(Microsoft.Xbox.Services.Multiplayer.MultiplayerSession,Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionWriteMode)

Remarks

If you leave a session that you are the last member of, and the sessionEmptyTimeout is equal to 0, then the session is deleted immediately and a nullptr is returned.

Calls V105 PUT /serviceconfigs/{serviceConfigurationId}/sessionTemplates/{sessiontemplateName}/sessions/{sessionName}.

Applies to