Skip to content

Region streaming endpoints #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 59 additions & 5 deletions Scripts/Connection/WSConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,19 @@ public TextMessage(string text, Dictionary<string, string> headers = null)
/// <summary>
/// Headers to pass when making the socket.
/// </summary>
public Dictionary<string, string> Headers { get; set; }
private Dictionary<string, string> _headers;
public Dictionary<string, string> Headers {
get
{
if (_headers == null)
_headers = new Dictionary<string, string>();
return _headers;
}
set
{
_headers = value;
}
}
/// <summary>
/// Credentials used to authenticate with the server.
/// </summary>
Expand Down Expand Up @@ -193,17 +205,59 @@ public static string FixupURL(string URL)
#if UNITY_2018_2_OR_NEWER
// Use standard endpoints since 2018.2 supports TLS 1.2
if (URL.StartsWith("http://stream."))
{
URL = URL.Replace("http://stream.", "ws://stream.");
}
else if (URL.StartsWith("https://stream."))
{
URL = URL.Replace("https://stream.", "wss://stream.");
}

// TLS 1.0 endpoint
else if (URL.StartsWith("http://stream-tls10."))
{
URL = URL.Replace("http://stream-tls10.", "ws://stream.");
}
else if (URL.StartsWith("https://stream-tls10."))
{
URL = URL.Replace("https://stream-tls10.", "wss://stream.");
else if (URL.StartsWith("http://stream-fra."))
URL = URL.Replace("http://stream-fra.", "ws://stream-fra.");
else if (URL.StartsWith("https://stream-fra."))
URL = URL.Replace("https://stream-fra.", "wss://stream-fra.");
}

// Germany
else if (URL.StartsWith("http://gateway-fra."))
{
URL = URL.Replace("http://gateway-fra.", "ws://stream-fra.");
}
else if (URL.StartsWith("https://gateway-fra."))
{
URL = URL.Replace("https://gateway-fra.", "wss://stream-fra.");
}

// US East
else if (URL.StartsWith("http://gateway-wdc."))
{
URL = URL.Replace("http://gateway-wdc.", "ws://gateway-wdc.");
}
else if (URL.StartsWith("https://gateway-wdc."))
{
URL = URL.Replace("https://gateway-wdc.", "wss://gateway-wdc.");
}


// Sydney
else if (URL.StartsWith("http://gateway-syd."))
{
URL = URL.Replace("http://gateway-syd.", "ws://gateway-syd.");
}
else if (URL.StartsWith("https://gateway-syd."))
{
URL = URL.Replace("https://gateway-syd.", "wss://gateway-syd.");
}

else
{
Log.Warning("WSConnector", "No case for URL for wss://. Leaving URL unchanged.");
}
#else
// Redirect to TLS 1.0 endpoints.
// Note frankfurt endpoint does not support TLS 1.0.
Expand Down
Loading