@@ -158,7 +158,19 @@ public TextMessage(string text, Dictionary<string, string> headers = null)
158158 /// <summary>
159159 /// Headers to pass when making the socket.
160160 /// </summary>
161- public Dictionary < string , string > Headers { get ; set ; }
161+ private Dictionary < string , string > _headers ;
162+ public Dictionary < string , string > Headers {
163+ get
164+ {
165+ if ( _headers == null )
166+ _headers = new Dictionary < string , string > ( ) ;
167+ return _headers ;
168+ }
169+ set
170+ {
171+ _headers = value ;
172+ }
173+ }
162174 /// <summary>
163175 /// Credentials used to authenticate with the server.
164176 /// </summary>
@@ -193,17 +205,59 @@ public static string FixupURL(string URL)
193205#if UNITY_2018_2_OR_NEWER
194206 // Use standard endpoints since 2018.2 supports TLS 1.2
195207 if ( URL . StartsWith ( "http://stream." ) )
208+ {
196209 URL = URL . Replace ( "http://stream." , "ws://stream." ) ;
210+ }
197211 else if ( URL . StartsWith ( "https://stream." ) )
212+ {
198213 URL = URL . Replace ( "https://stream." , "wss://stream." ) ;
214+ }
215+
216+ // TLS 1.0 endpoint
199217 else if ( URL . StartsWith ( "http://stream-tls10." ) )
218+ {
200219 URL = URL . Replace ( "http://stream-tls10." , "ws://stream." ) ;
220+ }
201221 else if ( URL . StartsWith ( "https://stream-tls10." ) )
222+ {
202223 URL = URL . Replace ( "https://stream-tls10." , "wss://stream." ) ;
203- else if ( URL . StartsWith ( "http://stream-fra." ) )
204- URL = URL . Replace ( "http://stream-fra." , "ws://stream-fra." ) ;
205- else if ( URL . StartsWith ( "https://stream-fra." ) )
206- URL = URL . Replace ( "https://stream-fra." , "wss://stream-fra." ) ;
224+ }
225+
226+ // Germany
227+ else if ( URL . StartsWith ( "http://gateway-fra." ) )
228+ {
229+ URL = URL . Replace ( "http://gateway-fra." , "ws://stream-fra." ) ;
230+ }
231+ else if ( URL . StartsWith ( "https://gateway-fra." ) )
232+ {
233+ URL = URL . Replace ( "https://gateway-fra." , "wss://stream-fra." ) ;
234+ }
235+
236+ // US East
237+ else if ( URL . StartsWith ( "http://gateway-wdc." ) )
238+ {
239+ URL = URL . Replace ( "http://gateway-wdc." , "ws://gateway-wdc." ) ;
240+ }
241+ else if ( URL . StartsWith ( "https://gateway-wdc." ) )
242+ {
243+ URL = URL . Replace ( "https://gateway-wdc." , "wss://gateway-wdc." ) ;
244+ }
245+
246+
247+ // Sydney
248+ else if ( URL . StartsWith ( "http://gateway-syd." ) )
249+ {
250+ URL = URL . Replace ( "http://gateway-syd." , "ws://gateway-syd." ) ;
251+ }
252+ else if ( URL . StartsWith ( "https://gateway-syd." ) )
253+ {
254+ URL = URL . Replace ( "https://gateway-syd." , "wss://gateway-syd." ) ;
255+ }
256+
257+ else
258+ {
259+ Log . Warning ( "WSConnector" , "No case for URL for wss://. Leaving URL unchanged." ) ;
260+ }
207261#else
208262 // Redirect to TLS 1.0 endpoints.
209263 // Note frankfurt endpoint does not support TLS 1.0.
0 commit comments