public IEnumerator Connect(GamebaseCallback.ErrorDelegate callback) { CreateSocket(); float waitTime = 0; while (false == IsConnected() && null == GetErrorMessage() && waitTime < CommunicatorConfiguration.connectionTimeout) { waitTime += Time.unscaledDeltaTime; yield return(null); } GamebaseError error = null; if (false == string.IsNullOrEmpty(GetErrorMessage())) { error = new GamebaseError(GamebaseErrorCode.SOCKET_ERROR, message: GetErrorMessage()); } else { if (waitTime >= CommunicatorConfiguration.connectionTimeout) { error = new GamebaseError(GamebaseErrorCode.SOCKET_ERROR); } else { GamebaseLog.Debug("socket connected.", this, "Connect"); } } StartRecvPolling(); callback(error); }
public static void SendIndicatorData( string logType, string stabilityCode, string logLevel, Dictionary <string, string> customFields, GamebaseError error = null, bool isUserCanceled = false, bool isExternalLibraryError = false) { if (stability.useFlagSpecificUser == false) { if (stability.useFlag == false) { return; } } if (ConvertLogLevelToEnum(stability.logLevel) > ConvertLogLevelToEnum(logLevel)) { return; } Dictionary <string, string> userFields = MakeindicatorDictionary(stabilityCode, customFields, error, isUserCanceled, isExternalLibraryError); logger.Log(logType, (ToastLogLevel)ConvertLogLevelToEnum(logLevel), stabilityCode, userFields); }
public void ShowHeartbeatErrorPopup(GamebaseError error) { if (true == Gamebase.IsSuccess(error)) { return; } GamebaseLog.Debug(string.Format("ErrorCode : {0}", error.code), this); switch (error.code) { case GamebaseErrorCode.BANNED_MEMBER: // 이용정지 KickOut { ShowKickOutPopup(); break; } case GamebaseErrorCode.INVALID_MEMBER: // 잘못된 사용자 KickOut { break; } default: { break; } } }
public void ShowErrorPopup(GamebaseError error, BaseVO vo = null) { if (true == Gamebase.IsSuccess(error)) { return; } GamebaseLog.Debug( string.Format("ErrorCode : {0}", error.code), this, "ShowErrorPopup"); switch (error.code) { case GamebaseErrorCode.AUTH_BANNED_MEMBER: // 이용정지 { ShowBanPopup((AuthResponse.LoginInfo)vo); break; } default: { break; } } }
private static void CreateGamebaseErrorByTraceErrorRecursion(GamebaseError gamebaseError, CommonResponse.Header.TraceError traceError) { gamebaseError.error = new GamebaseError(traceError.resultCode, traceError.throwPoint, traceError.resultMessage); if (traceError.traceError != null) { CreateGamebaseErrorByTraceErrorRecursion(gamebaseError.error, traceError.traceError); } }
virtual protected void OnLogout(NativeMessage message) { GamebaseError error = message.GetGamebaseError(); if (Gamebase.IsSuccess(error) == true) { AuthAdapterManager.Instance.IDPLogoutAll(); } }
virtual protected void OnRemoveMapping(NativeMessage message) { GamebaseError error = message.GetGamebaseError(); string providerName = GamebaseExtraDataHandler.GetExtraData(message.handle); GamebaseExtraDataHandler.UnregisterExtraData(message.handle); if (Gamebase.IsSuccess(error) == true) { AuthAdapterManager.Instance.IDPLogout(providerName); } }
private void SendObserverEvent(GamebaseError error) { GamebaseObserverManager.Instance.OnObserverEvent( new GamebaseResponse.SDK.ObserverMessage() { type = GamebaseObserverType.INTROSPECT, data = new Dictionary <string, object>() { { "error", error } } }); }
private void SendIntrospect() { GamebaseLog.Debug("Send Introspect", this); var requestVO = IntrospectMessage.MakeIntrospectMessage(); WebSocket.Instance.Request(requestVO, (response, error) => { GamebaseError introspectError = error; if (introspectError == null) { var vo = JsonMapper.ToObject <LaunchingResponse.IntrospectInfo>(response); if (vo.header.isSuccessful == true) { GamebaseLog.Debug("Send Introspect succeeded", this); retryCount = 0; sentIntervalTime = refrashIntervalTime; return; } else { introspectError = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, string.Empty); } } if (introspectError != null) { if (introspectError.code == GamebaseErrorCode.SOCKET_RESPONSE_TIMEOUT || introspectError.code == GamebaseErrorCode.SOCKET_ERROR) { sentIntervalTime = retryIntervalTime; retryCount++; if (retryCount <= MAX_RETRY_COUNT) { return; } } retryCount = 0; StopIntrospect(); SendObserverEvent(introspectError); } }); }
private static Dictionary <string, string> MakeindicatorDictionary( string stabilityCode, Dictionary <string, string> customFields, GamebaseError error, bool isUserCanceled, bool isExternalLibraryError) { Dictionary <string, string> indicatorDictionary = new Dictionary <string, string>(); if (string.IsNullOrEmpty(stabilityCode) == false) { indicatorDictionary.Add(GB_STABILITY_CODE, stabilityCode); } if (error != null) { indicatorDictionary.Add(GB_EXCEPTION, error.ToString()); indicatorDictionary.Add(GB_ERROR_CODE, error.code.ToString()); indicatorDictionary.Add(GB_ERROR_DOMAIN, error.domain); if (error.error != null) { indicatorDictionary.Add(GB_DETAIL_ERROR_CODE, error.error.code.ToString()); indicatorDictionary.Add(GB_DETAIL_ERROR_MESSAGE, error.error.message); } } if (isUserCanceled == true) { indicatorDictionary.Add(GB_IS_USER_CANCELED, "Y"); } if (isExternalLibraryError == true) { indicatorDictionary.Add(GB_IS_EXTERNAL_LIBRARY_ERROR, "Y"); } MergeDictionary(ref indicatorDictionary, basicDataDictionary); MergeDictionary(ref indicatorDictionary, customFields); return(indicatorDictionary); }
private void SendHeartbeat() { var requestVO = HeartbeatMessage.GetHeartbeatMessage(); WebSocket.Instance.Request(requestVO, (response, error) => { GamebaseError heartbeatError = error; if (null == heartbeatError) { var vo = JsonMapper.ToObject <LaunchingResponse.HeartbeatInfo>(response); if (true == vo.header.isSuccessful) { GamebaseLog.Debug("Send heartbeat succeeded", this, "SendHeartbeat"); } else { heartbeatError = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, string.Empty); } } if (null != heartbeatError) { if (GamebaseErrorCode.BANNED_MEMBER == heartbeatError.code || GamebaseErrorCode.INVALID_MEMBER == heartbeatError.code) { GamebaseSystemPopup.Instance.ShowHeartbeatErrorPopup(heartbeatError); var observerCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> >(GamebaseObserverManager.Instance.Handle); if (null != observerCallback) { var vo = new GamebaseResponse.SDK.ObserverMessage(); vo.type = GamebaseObserverType.HEARTBEAT; vo.data = new System.Collections.Generic.Dictionary <string, object>(); vo.data.Add("code", heartbeatError.code); observerCallback(vo); } } GamebaseLog.Debug(string.Format("Send heartbeat failed. error:{0}", heartbeatError), this, "SendHeartbeat"); } lastSentTime = DateTime.Now; }); }
public static GamebaseError CreateGamebaseErrorByServerErrorCode(string transactionId, string apiId, CommonResponse.Header header, string domain = null) { int errorCode = 0; switch (header.resultCode) { //---------------------------------------- // Common //---------------------------------------- case GamebaseServerErrorCode.TYPE_MISS_MATCH: case GamebaseServerErrorCode.ILLEGAL_ARGUMENT: case GamebaseServerErrorCode.HTTP_MESSAGE_NOT_READABLE: case GamebaseServerErrorCode.MISSING_SERVLET_REQUEST_PARAMETER: case GamebaseServerErrorCode.METHOD_ARGUMENT_NOT_VALID: case GamebaseServerErrorCode.METHOD_ARGUMENT_TYPE_MISMATCH: case GamebaseServerErrorCode.INVALID_APP_ID: case GamebaseServerErrorCode.INVALID_APP_KEY: case GamebaseServerErrorCode.INVALID_SECRET_KEY: { errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; } case GamebaseServerErrorCode.NOT_AUTHENTICATED: { errorCode = GamebaseErrorCode.NOT_LOGGED_IN; break; } case GamebaseServerErrorCode.UNKNOWN_SYSTEM: { errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; } case GamebaseServerErrorCode.REMOTE_SYSTEM: { errorCode = GamebaseErrorCode.SERVER_REMOTE_SYSTEM_ERROR; break; } case GamebaseServerErrorCode.BANNED_MEMBER: { errorCode = GamebaseErrorCode.BANNED_MEMBER; break; } case GamebaseServerErrorCode.INVALID_MEMBER: { errorCode = GamebaseErrorCode.INVALID_MEMBER; break; } //---------------------------------------- // Lighthouse //---------------------------------------- case GamebaseServerErrorCode.LIGHT_HOUSE_NOT_AUTHENTICATED: { errorCode = GamebaseErrorCode.NOT_LOGGED_IN; break; } case GamebaseServerErrorCode.LIGHT_HOUSE_NO_SUCH_REQUEST_API: { errorCode = GamebaseErrorCode.NOT_SUPPORTED; break; } case GamebaseServerErrorCode.LIGHT_HOUSE_JSON_PARSING_ERROR: { errorCode = GamebaseErrorCode.INVALID_JSON_FORMAT; break; } case GamebaseServerErrorCode.LIGHT_HOUSE_GATEWAY_CONNECTION_ERROR: { errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; } //---------------------------------------- // Gateway //---------------------------------------- case GamebaseServerErrorCode.GATEWAY_JSON_PARSING_ERROR: { errorCode = GamebaseErrorCode.INVALID_JSON_FORMAT; break; } case GamebaseServerErrorCode.GATEWAY_MISSING_REQUEST_PARAMETER: case GamebaseServerErrorCode.GATEWAY_INVALID_APP_ID: { errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; } case GamebaseServerErrorCode.GATEWAY_INVALID_ACCESS_TOKEN: { errorCode = GamebaseErrorCode.AUTH_TOKEN_LOGIN_INVALID_TOKEN_INFO; break; } case GamebaseServerErrorCode.GATEWAY_PRODUCT_DATA_NOT_FOUND: { errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; } case GamebaseServerErrorCode.GATEWAY_REQUEST_API_NOT_FOUND: { errorCode = GamebaseErrorCode.NOT_SUPPORTED; break; } case GamebaseServerErrorCode.GATEWAY_LOGGED_IN_IDP_COULD_NOT_DELETED: { errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_LOGGED_IN_IDP; break; } case GamebaseServerErrorCode.GATEWAY_UNKNOWN_SYSTEM: { errorCode = GamebaseErrorCode.SERVER_UNKNOWN_ERROR; break; } case GamebaseServerErrorCode.GATEWAY_REQUEST_WORKER_ERROR: case GamebaseServerErrorCode.GATEWAY_QUEUE_TIME_OUT: case GamebaseServerErrorCode.GATEWAY_QUEUE_CAPACITY_FULL: { errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; } case GamebaseServerErrorCode.GATEWAY_GB_LNC_SYSTEM_ERROR: { errorCode = GamebaseErrorCode.LAUNCHING_SERVER_ERROR; break; } case GamebaseServerErrorCode.GATEWAY_GB_ID_SYSTEM_ERROR: { errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; } //---------------------------------------- // Launching //---------------------------------------- case GamebaseServerErrorCode.LAUNCHING_NOT_EXIST_CLIENT_ID: { errorCode = GamebaseErrorCode.LAUNCHING_NOT_EXIST_CLIENT_ID; break; } case GamebaseServerErrorCode.LAUNCHING_UNREGISTERED_APP: { errorCode = GamebaseErrorCode.LAUNCHING_UNREGISTERED_APP; break; } case GamebaseServerErrorCode.LAUNCHING_UNREGISTERED_CLIENT: { errorCode = GamebaseErrorCode.LAUNCHING_UNREGISTERED_CLIENT; break; } //---------------------------------------- // Member //---------------------------------------- case GamebaseServerErrorCode.MEMBER_APP_ID_MISS_MATCH: { errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; } case GamebaseServerErrorCode.MEMBER_USER_ID_MISS_MATCH: case GamebaseServerErrorCode.MEMBER_INVALID_MEMBER: { errorCode = GamebaseErrorCode.INVALID_MEMBER; break; } case GamebaseServerErrorCode.MEMBER_INVALID_AUTH: { if (apiId.Equals(Lighthouse.API.Gateway.ID.TOKEN_LOGIN, StringComparison.Ordinal) == true) { errorCode = GamebaseErrorCode.AUTH_TOKEN_LOGIN_INVALID_TOKEN_INFO; } else if (apiId.Equals(Lighthouse.API.Gateway.ID.IDP_LOGIN, StringComparison.Ordinal) == true) { errorCode = GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED; } else if (apiId.Equals(Lighthouse.API.Gateway.ID.ADD_MAPPING, StringComparison.Ordinal) == true) { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FAILED; } else if (apiId.Equals(Lighthouse.API.Gateway.ID.REMOVE_MAPPING, StringComparison.Ordinal) == true) { errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_FAILED; } else if (apiId.Equals(Lighthouse.API.Gateway.ID.WITHDRAW, StringComparison.Ordinal) == true) { errorCode = GamebaseErrorCode.AUTH_WITHDRAW_FAILED; } else { errorCode = GamebaseErrorCode.AUTH_UNKNOWN_ERROR; } break; } case GamebaseServerErrorCode.BANNED_MEMBER_LOGIN: case GamebaseServerErrorCode.AUTHKEY_BELONG_TO_BANNED_MEMBER: { errorCode = GamebaseErrorCode.BANNED_MEMBER; break; } case GamebaseServerErrorCode.MEMBER_NOT_EXIST: { errorCode = GamebaseErrorCode.AUTH_NOT_EXIST_MEMBER; break; } case GamebaseServerErrorCode.MEMBER_LAST_MAPPED_IDP: { errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_LAST_MAPPED_IDP; break; } case GamebaseServerErrorCode.MEMBER_TRANSFERACCOUNT_ALREADY_USED: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_ALREADY_USED; break; } case GamebaseServerErrorCode.MEMBER_ALREADY_MAPPED_MEMBER: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER; break; } case GamebaseServerErrorCode.MEMBER_ALREADY_MAPPED_IDP: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_ALREADY_HAS_SAME_IDP; break; } case GamebaseServerErrorCode.CAN_NOT_ADD_GUEST_IDP: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_CANNOT_ADD_GUEST_IDP; break; } // // Add Mapping Forcibly // case GamebaseServerErrorCode.MEMBER_FORCING_MAPPING_TICKET_NOT_EXIST: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FORCIBLY_NOT_EXIST_KEY; break; } case GamebaseServerErrorCode.MEMBER_CONSUMED_FORCING_MAPPING_TICKET: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FORCIBLY_ALREADY_USED_KEY; break; } case GamebaseServerErrorCode.MEMBER_EXPIRED_FORCING_MAPPING_TICKET: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FORCIBLY_EXPIRED_KEY; break; } case GamebaseServerErrorCode.MEMBER_IDP_MISS_MATCH_FOR_FORCING_MAPPING: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FORCIBLY_DIFFERENT_IDP; break; } case GamebaseServerErrorCode.MEMBER_AUTHKEY_MISS_MATCH_FOR_FORCING_MAPPING: { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FORCIBLY_DIFFERENT_AUTHKEY; break; } case GamebaseServerErrorCode.GATEWAY_USER_MUST_HAVE_ONLY_GUEST_IDP: case GamebaseServerErrorCode.MEMBER_IS_NOT_GUEST: { errorCode = GamebaseErrorCode.NOT_GUEST_OR_HAS_OTHERS; break; } //---------------------------------------- // Transfer Account //---------------------------------------- case GamebaseServerErrorCode.MEMBER_TRANSFERACCOUNT_EXPIRED: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_EXPIRED; break; } case GamebaseServerErrorCode.MEMBER_BLOCK_ID: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_BLOCK; break; } case GamebaseServerErrorCode.MEMBER_NEOID_CHECK_PASSWORD_NOT_EXIST_ID: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_INVALID_ID; break; } case GamebaseServerErrorCode.MEMBER_NEOID_CHECK_PASSWORD_INVALID_PASSWORD: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_INVALID_PASSWORD; break; } case GamebaseServerErrorCode.MEMBER_CONSOLE_NO_CONDITION: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_CONSOLE_NO_CONDITION; break; } case GamebaseServerErrorCode.MEMBER_TRANSFERACCOUNT_NOT_EXIST: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_NOT_EXIST; break; } case GamebaseServerErrorCode.MEMBER_NEOID_SIGNUP_ALREADY_EXIST_ID: { errorCode = GamebaseErrorCode.AUTH_TRANSFERACCOUNT_ALREADY_EXIST_ID; break; } case GamebaseServerErrorCode.MEMBER_SAME_REQUESTOR: { errorCode = GamebaseErrorCode.SAME_REQUESTOR; break; } case GamebaseServerErrorCode.MEMBER_ALREADY_WITHDRAWN: { errorCode = GamebaseErrorCode.AUTH_WITHDRAW_FAILED; break; } case GamebaseServerErrorCode.MEMBER_NEOID_SIGNUP_UNKNOWN: case GamebaseServerErrorCode.MEMBER_NEOID_CHECK_PASSWORD_UNKNOWN: case GamebaseServerErrorCode.MEMBER_NEOID_QUERY: case GamebaseServerErrorCode.MEMBER_NEOID_QUERY_INFO: case GamebaseServerErrorCode.MEMBER_NEOID_CREATE_PASSWORD: case GamebaseServerErrorCode.MEMBER_NEOID_CONNECTION: { errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; } default: { errorCode = GamebaseErrorCode.UNKNOWN_ERROR; break; } } var traceError = header.traceError; if (IsRecursive(traceError) == true) { var gamebaseServerError = new GamebaseError(header.resultCode, traceError.productId, header.resultMessage); CreateGamebaseErrorByTraceErrorRecursion(gamebaseServerError, traceError); return(new GamebaseError(errorCode, domain, string.Empty, gamebaseServerError, transactionId)); } else { return(new GamebaseError(errorCode, domain, string.Empty, new GamebaseError(header.resultCode, traceError.throwPoint, header.resultMessage), transactionId)); } }
public static GamebaseError CreateGamebaseErrorByServerErrorCode(string transactionId, string apiId, CommonResponse.Header header, string domain = null) { int errorCode; switch (header.resultCode) { //---------------------------------------- // Common //---------------------------------------- case GamebaseServerErrorCode.TYPE_MISS_MATCH: case GamebaseServerErrorCode.ILLEGAL_ARGUMENT: case GamebaseServerErrorCode.HTTP_MESSAGE_NOT_READABLE: case GamebaseServerErrorCode.MISSING_SERVLET_REQUEST_PARAMETER: case GamebaseServerErrorCode.METHOD_ARGUMENT_NOT_VALID: case GamebaseServerErrorCode.METHOD_ARGUMENT_TYPE_MISMATCH: case GamebaseServerErrorCode.INVALID_APP_ID: case GamebaseServerErrorCode.INVALID_APP_KEY: errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; case GamebaseServerErrorCode.NOT_AUTHENTICATED: errorCode = GamebaseErrorCode.NOT_LOGGED_IN; break; case GamebaseServerErrorCode.UNKNOWN_SYSTEM: errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; case GamebaseServerErrorCode.REMOTE_SYSTEM: errorCode = GamebaseErrorCode.SERVER_REMOTE_SYSTEM_ERROR; break; case GamebaseServerErrorCode.BANNED_MEMBER: errorCode = GamebaseErrorCode.BANNED_MEMBER; break; case GamebaseServerErrorCode.INVALID_MEMBER: errorCode = GamebaseErrorCode.INVALID_MEMBER; break; //---------------------------------------- // Lighthouse //---------------------------------------- case GamebaseServerErrorCode.LIGHT_HOUSE_NOT_AUTHENTICATED: errorCode = GamebaseErrorCode.NOT_LOGGED_IN; break; case GamebaseServerErrorCode.LIGHT_HOUSE_NO_SUCH_REQUEST_API: errorCode = GamebaseErrorCode.NOT_SUPPORTED; break; case GamebaseServerErrorCode.LIGHT_HOUSE_JSON_PARSING_ERROR: errorCode = GamebaseErrorCode.INVALID_JSON_FORMAT; break; case GamebaseServerErrorCode.LIGHT_HOUSE_GATEWAY_CONNECTION_ERROR: errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; //---------------------------------------- // Gateway //---------------------------------------- case GamebaseServerErrorCode.GATEWAY_JSON_PARSING_ERROR: errorCode = GamebaseErrorCode.INVALID_JSON_FORMAT; break; case GamebaseServerErrorCode.GATEWAY_MISSING_REQUEST_PARAMETER: case GamebaseServerErrorCode.GATEWAY_INVALID_APP_ID: errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; case GamebaseServerErrorCode.GATEWAY_INVALID_ACCESS_TOKEN: errorCode = GamebaseErrorCode.AUTH_TOKEN_LOGIN_INVALID_TOKEN_INFO; break; case GamebaseServerErrorCode.GATEWAY_PRODUCT_DATA_NOT_FOUND: errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; case GamebaseServerErrorCode.GATEWAY_REQUEST_API_NOT_FOUND: errorCode = GamebaseErrorCode.NOT_SUPPORTED; break; case GamebaseServerErrorCode.GATEWAY_LOGGED_IN_IDP_COULD_NOT_DELETED: errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_LOGGED_IN_IDP; break; case GamebaseServerErrorCode.GATEWAY_UNKNOWN_SYSTEM: errorCode = GamebaseErrorCode.SERVER_UNKNOWN_ERROR; break; case GamebaseServerErrorCode.GATEWAY_REQUEST_WORKER_ERROR: case GamebaseServerErrorCode.GATEWAY_QUEUE_TIME_OUT: case GamebaseServerErrorCode.GATEWAY_QUEUE_CAPACITY_FULL: errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; case GamebaseServerErrorCode.GATEWAY_GB_LNC_SYSTEM_ERROR: errorCode = GamebaseErrorCode.LAUNCHING_SERVER_ERROR; break; case GamebaseServerErrorCode.GATEWAY_GB_ID_SYSTEM_ERROR: errorCode = GamebaseErrorCode.SERVER_INTERNAL_ERROR; break; //---------------------------------------- // Launching //---------------------------------------- case GamebaseServerErrorCode.LAUNCHING_NOT_EXIST_CLIENT_ID: errorCode = GamebaseErrorCode.LAUNCHING_NOT_EXIST_CLIENT_ID; break; case GamebaseServerErrorCode.LAUNCHING_UNREGISTERED_APP: errorCode = GamebaseErrorCode.LAUNCHING_UNREGISTERED_APP; break; case GamebaseServerErrorCode.LAUNCHING_UNREGISTERED_CLIENT: errorCode = GamebaseErrorCode.LAUNCHING_UNREGISTERED_CLIENT; break; //---------------------------------------- // Member //---------------------------------------- case GamebaseServerErrorCode.MEMBER_APP_ID_MISS_MATCH: errorCode = GamebaseErrorCode.INVALID_PARAMETER; break; case GamebaseServerErrorCode.MEMBER_USER_ID_MISS_MATCH: case GamebaseServerErrorCode.MEMBER_INVALID_MEMBER: errorCode = GamebaseErrorCode.AUTH_INVALID_MEMBER; break; case GamebaseServerErrorCode.MEMBER_INVALID_AUTH: { if (true == apiId.Equals(Lighthouse.API.Gateway.ID.TOKEN_LOGIN, StringComparison.Ordinal)) { errorCode = GamebaseErrorCode.AUTH_TOKEN_LOGIN_INVALID_TOKEN_INFO; } else if (true == apiId.Equals(Lighthouse.API.Gateway.ID.IDP_LOGIN, StringComparison.Ordinal)) { errorCode = GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED; } else if (true == apiId.Equals(Lighthouse.API.Gateway.ID.ADD_MAPPING, StringComparison.Ordinal)) { errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_FAILED; } else if (true == apiId.Equals(Lighthouse.API.Gateway.ID.REMOVE_MAPPING, StringComparison.Ordinal)) { errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_FAILED; } else { errorCode = GamebaseErrorCode.AUTH_UNKNOWN_ERROR; } break; } case GamebaseServerErrorCode.BANNED_MEMBER_LOGIN: case GamebaseServerErrorCode.AUTHKEY_BELONG_TO_BANNED_MEMBER: errorCode = GamebaseErrorCode.AUTH_BANNED_MEMBER; break; case GamebaseServerErrorCode.MEMBER_NOT_EXIST: errorCode = GamebaseErrorCode.AUTH_NOT_EXIST_MEMBER; break; case GamebaseServerErrorCode.MEMBER_LAST_MAPPED_IDP: errorCode = GamebaseErrorCode.AUTH_REMOVE_MAPPING_LAST_MAPPED_IDP; break; case GamebaseServerErrorCode.MEMBER_ALREADY_WITHDRAWN: errorCode = GamebaseErrorCode.AUTH_WITHDRAW_FAILED; break; case GamebaseServerErrorCode.MEMBER_ALREADY_MAPPED_MEMBER: errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER; break; case GamebaseServerErrorCode.MEMBER_ALREADY_MAPPED_IDP: errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_ALREADY_HAS_SAME_IDP; break; case GamebaseServerErrorCode.CAN_NOT_ADD_GUEST_IDP: errorCode = GamebaseErrorCode.AUTH_ADD_MAPPING_CANNOT_ADD_GUEST_IDP; break; default: errorCode = GamebaseErrorCode.UNKNOWN_ERROR; break; } var traceError = header.traceError; if (true == traceError.throwPoint.Equals("gbId", StringComparison.Ordinal)) { var GamebaseServerError = new GamebaseError(header.resultCode, traceError.productId, header.resultMessage); var colonDelimiter = new string[] { "::" }; var colonDelimiterIndex = traceError.resultMessage.IndexOf(colonDelimiter[0]); if (-1 == colonDelimiterIndex) { GamebaseServerError.error = new GamebaseError(traceError.resultCode, traceError.throwPoint, traceError.resultMessage); } else { var gbIdMessage = traceError.resultMessage.Split(colonDelimiter, 2, StringSplitOptions.None); var gbIdError = new GamebaseError(traceError.resultCode, traceError.throwPoint, gbIdMessage[0].TrimEnd()); GamebaseServerError.error = gbIdError; var equalsSignDelimiter = new string[] { "=" }; var equalsSignDelimiterIndex = gbIdMessage[1].TrimStart().IndexOf(equalsSignDelimiter[0]); if (-1 != equalsSignDelimiterIndex) { var detailMessage = gbIdMessage[1].Split(equalsSignDelimiter, 2, StringSplitOptions.None); gbIdError.error = new GamebaseError(-1, detailMessage[0].TrimEnd(), detailMessage[1].TrimStart()); } } return(new GamebaseError(errorCode, domain, string.Empty, GamebaseServerError, transactionId)); } else { return(new GamebaseError(errorCode, domain, string.Empty, new GamebaseError(header.resultCode, traceError.throwPoint, header.resultMessage), transactionId)); } }
private void SendHeartbeat() { var requestVO = HeartbeatMessage.GetHeartbeatMessage(); WebSocket.Instance.Request(requestVO, (response, error) => { GamebaseError heartbeatError = error; if (null == heartbeatError) { var vo = JsonMapper.ToObject <LaunchingResponse.HeartbeatInfo>(response); if (true == vo.header.isSuccessful) { GamebaseLog.Debug("Send heartbeat succeeded", this); } else { heartbeatError = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, string.Empty); } } if (null != heartbeatError) { if (GamebaseErrorCode.BANNED_MEMBER == heartbeatError.code || GamebaseErrorCode.INVALID_MEMBER == heartbeatError.code) { var vo = new GamebaseResponse.SDK.ObserverMessage(); vo.type = GamebaseObserverType.HEARTBEAT; vo.data = new System.Collections.Generic.Dictionary <string, object>(); vo.data.Add("code", heartbeatError.code); if (GamebaseErrorCode.BANNED_MEMBER == heartbeatError.code) { GamebaseIndicatorReport.SendIndicatorData( GamebaseIndicatorReportType.LogType.EVENT, GamebaseIndicatorReportType.StabilityCode.GB_EVENT_OBSERVER_BANNED_MEMBER, GamebaseIndicatorReportType.LogLevel.INFO, new Dictionary <string, string>() { { GamebaseIndicatorReportType.AdditionalKey.GB_OBSERVER_DATA, JsonMapper.ToJson(vo) } }); } else { GamebaseIndicatorReport.SendIndicatorData( GamebaseIndicatorReportType.LogType.EVENT, GamebaseIndicatorReportType.StabilityCode.GB_EVENT_OBSERVER_INVALID_MEMBER, GamebaseIndicatorReportType.LogLevel.INFO, new Dictionary <string, string>() { { GamebaseIndicatorReportType.AdditionalKey.GB_OBSERVER_DATA, JsonMapper.ToJson(vo) } }); } GamebaseSystemPopup.Instance.ShowHeartbeatErrorPopup(heartbeatError); var observerCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> >(GamebaseObserverManager.Instance.Handle); if (null != observerCallback) { observerCallback(vo); } } GamebaseLog.Debug(string.Format("Send heartbeat failed. error:{0}", GamebaseJsonUtil.ToPrettyJsonString(heartbeatError)), this); } lastSentTime = DateTime.Now; }); }