MultiplayerService.WriteSessionAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
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.