The REST and SignalR APIs documented here are more complex than the client SDKs. Consider using the Lobby C++ SDK or Matchmaking C++ SDK instead, unless those SDKs don’t meet your needs.
Connecting to the SignalR Hub
The first step in receiving real-time messages is to create a SignalR client. The client can create a connection to the SignalR Hub by instantiating a HubConnection with the following API: SignalR Negotiate REST API. This API implements the Negotiate API described in the SignalR documentation.The client must set
KeepAliveInterval to 5 seconds when building the HubConnection. The backend service will time out and close connections that do not receive a keep-alive ping within 10 seconds. The default SignalR KeepAliveInterval of 15 seconds is too slow and will cause disconnections. csharp var connection = new HubConnectionBuilder() .WithUrl(hubUrl, options => { /* auth headers */ }) .WithKeepAliveInterval(TimeSpan.FromSeconds(5)) .Build(); For more details on SignalR client configuration, see the SignalR configuration documentation.- SignalR client implementations expect the URL to omit the
/negotiateportion of this path (for example, HubConnection should be created to a URL that ends in...playfabapi.com/pubsub). 1. The auth headers required to call this API can be passed to the SignalR client viaHttpConnectionOptionsas seen on this method.
Implementing client methods to receive messages
See the SignalR Client documentation about implementing client methods that will be invoked to receive messages. Clients should implement all of the methods listed in Client methods below.Starting and ending a session by calling server methods
See the SignalR Client documentation about calling server methods to manage your session. For example, once connected to the hub, you must call StartOrRecoverSession to receive aconnection handle that you can use to subscribe to
resources. Similarly, once you’re done with the
session, call EndSession.
Subscribing to resources
Once a session has been started with StartOrRecoverSession, you can use theconnection handle returned to start subscribing to
resources and receiving messages.
