1
This commit is contained in:
@@ -32,12 +32,12 @@ namespace Assets.MyGame.Scripts.Net
|
||||
|
||||
//private const string baseUrl = "ws://game5241.wzaxr.top";
|
||||
#if UNITY_EDITOR
|
||||
private const string baseUrl = "ws://8.137.163.153";
|
||||
//private const string baseUrl = "ws://8.137.8.46";
|
||||
//private const string baseUrl = "ws://8.137.163.153";
|
||||
private const string baseUrl = "ws://47.109.34.50";
|
||||
|
||||
#else
|
||||
//private const string baseUrl = "ws://8.137.8.46";
|
||||
private const string baseUrl = "ws://8.137.163.153";
|
||||
private const string baseUrl = "ws://47.109.34.50";
|
||||
|
||||
#endif
|
||||
public bool isGame = false;
|
||||
@@ -117,6 +117,13 @@ namespace Assets.MyGame.Scripts.Net
|
||||
socketUrls[type] = url;
|
||||
handshakeActions[type] = action;
|
||||
var ws = new WebSocket(new Uri(url));
|
||||
// Best.WebSockets 1.22.3 bug:服务器返回 3xx 重定向时,InternalRequest_OnBeforeRedirection
|
||||
// 会再次调用 StartOpen(),但实例已 open 过,抛 "Open already called!"。
|
||||
// 这里禁用内部 HTTP 请求的重定向跟随来规避。
|
||||
ws.OnInternalRequestCreated += (socket, req) =>
|
||||
{
|
||||
req.RedirectSettings.MaxRedirects = 0;
|
||||
};
|
||||
sockets[type] = ws;
|
||||
// 事件绑定
|
||||
ws.OnOpen += (web) =>
|
||||
|
||||
Reference in New Issue
Block a user