Allow for configurable SignalR connection settings
This commit is contained in:
@@ -4,4 +4,6 @@ public class PlayFabSettings
|
|||||||
{
|
{
|
||||||
public string PublisherId { get; set; }
|
public string PublisherId { get; set; }
|
||||||
public string TitleId { get; set; }
|
public string TitleId { get; set; }
|
||||||
|
public string SignalRURL { get; set; }
|
||||||
|
public string SignalRAccessToken { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,26 @@
|
|||||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Prospect.Server.Api.Config;
|
||||||
|
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||||
|
|
||||||
namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
||||||
|
|
||||||
[CloudScriptFunction("GetSignalRConnection")]
|
[CloudScriptFunction("GetSignalRConnection")]
|
||||||
public class GetSignalRConnection : ICloudScriptFunction<FYGetSignalRConnection, FYGetSignalRConnectionResult>
|
public class GetSignalRConnection : ICloudScriptFunction<FYGetSignalRConnection, FYGetSignalRConnectionResult>
|
||||||
{
|
{
|
||||||
|
private readonly PlayFabSettings _settings;
|
||||||
|
|
||||||
|
public GetSignalRConnection(IOptions<PlayFabSettings> settings)
|
||||||
|
{
|
||||||
|
_settings = settings.Value;
|
||||||
|
}
|
||||||
|
|
||||||
public Task<FYGetSignalRConnectionResult> ExecuteAsync(FYGetSignalRConnection request)
|
public Task<FYGetSignalRConnectionResult> ExecuteAsync(FYGetSignalRConnection request)
|
||||||
{
|
{
|
||||||
|
// The game client connects to SignalR only over HTTPS
|
||||||
return Task.FromResult(new FYGetSignalRConnectionResult
|
return Task.FromResult(new FYGetSignalRConnectionResult
|
||||||
{
|
{
|
||||||
Url = "https://2ea46.playfabapi.com/signalr/?hub=pubsub",
|
Url = _settings.SignalRURL,
|
||||||
AccessToken = "TEST"
|
AccessToken = _settings.SignalRAccessToken
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,11 @@
|
|||||||
},
|
},
|
||||||
"PlayFabSettings": {
|
"PlayFabSettings": {
|
||||||
"PublisherId": "850902E5B40508ED",
|
"PublisherId": "850902E5B40508ED",
|
||||||
"TitleId": "2EA46"
|
"TitleId": "2EA46",
|
||||||
|
"SignalRURL": "https://127.0.0.1:8443/signalr/?hub=pubsub",
|
||||||
|
"SignalRAccessToken": "TEST"
|
||||||
},
|
},
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
|
||||||
"Https": {
|
|
||||||
"Url": "https://2EA46.playfabapi.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Certificates": {
|
"Certificates": {
|
||||||
"Default": {
|
"Default": {
|
||||||
"Path": ".\\certificate.pfx"
|
"Path": ".\\certificate.pfx"
|
||||||
|
|||||||
Reference in New Issue
Block a user