Edit

Share via


MultiplayerService.WriteSessionAsync Method

Definition

Writes a new or updated multiplayer session to the multiplayer service.

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

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<MultiplayerSession>

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 a MultiplayerSession object containing the response returned from the server. The attributes in it might be different from the attributes in the passed-in MultiplayerSession object.

Implements

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

Remarks

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

If your client needs to pass a handle ID when writing the session, it should call the MultiplayerService.WriteSessionByHandleAsync Method.

If the client calls the MultiplayerSession.Leave Method for the last member of the session, when the session is using a sessionEmptyTimeout value of 0, the session is deleted immediately. After the call to MultiplayerSession.Leave, the client calls WriteSessionAsync to write local changes. This call returns a null pointer with an HTTP/204 status code, since the session has been deleted.

Applies to