[Problem/Question]
// Detailed description of issue.
I cloned the repository at GitHub - sendbird/sendbird-chat-sample-react-native: Sendbird Chat SDK sample for React-Native. and was able to start the sample app and login as a test user.
I created my own “Application” in Sendbird, and copied the App ID from there into sendbird-chat-sample-react-native/App.tsx
Now launch the application, enter your user ID, click “Connect” and you will be registered successfully. On the dashboard, the status appears to be online, but after loading the app, a blank screen appears and SendbirdError 800190 Connection timeout.
An error occurs.
I’m trying to subtract time from the websocketResponseTimeout, but it seems to work
Although it is the same code, only 1 of the 5 different App_IDs operates normally, and the above error occurs for the rest.
I absolutely have to use a different ID than the one that works.
// If problem, please fill out the below. If question, please delete.
[UIKit Version]
// What version of the SDK are you using?
V4
[Reproduction Steps]
// Please provide reproduction steps and, if possible, code snippets.
import { useRootContext } from ‘…/contexts/RootContext’;
import { ActivityIndicator, StyleSheet, Platform } from ‘react-native’;
import { Button, useUIKitTheme } from ‘@sendbird/uikit-react-native-foundation’;
import React, { useEffect, useState, useContext } from ‘react’;
import { isCacheRestrictedError } from ‘…/libs/utils’;
import { logger } from ‘…/libs/logger’;
import { authHandler } from ‘…/libs/auth’;
import { permissionHandler } from ‘…/libs/permissions’;
import messaging from ‘@react-native-firebase/messaging’;
import { useAppNavigation, Routes } from ‘…/libs/navigation’;
import { UserContext, UserContextType } from ‘…/contexts/UserContext’;
const ConnectScreen = () => {
const { navigation } = useAppNavigation();
const { sdk, setUser } = useRootContext();
const { colors } = useUIKitTheme();
const { userInfo } = useContext(UserContext) as UserContextType;
const [loading, setLoading] = useState(true);
const [connecting, setConnecting] = useState(false);
const [state, setState] = useState({
id: ‘’,
nickname: ‘’,
accessToken: ‘’,
});
useEffect(() => {
const email = userInfo.email.replace(/@/g, ‘^’);
const nickname = ${userInfo.firstName || ''} ${userInfo.lastName || ''}
.trim();
setState({
id: email,
nickname: nickname,
accessToken: ‘’,
});
// Set loading to false to allow connect function to be called
setLoading(false);
}, [userInfo]);
useEffect(() => {
if (!loading) {
onPressConnect();
}
}, [loading]);
const onPressConnect = async () => {
await connect(state.id, state.nickname, state.accessToken);
};
const connect = async (userId: string, nickname: string, token?: string) => {
logger.log(‘Try connecting…’);
try {
setConnecting(true);
logger.log('Connecting with:', userId, token);
const user = await sdk.connect(userId, token);
setUser(user);
logger.log('Connected successfully:', user);
const postConnect: Array<PromiseLike<void>> = [];
postConnect.push(authHandler.storeUser(user));
postConnect.push(sdk.updateCurrentUserInfo({ nickname }).then(setUser));
postConnect.push(
permissionHandler.requestPermissions().then(async ({ notification }) => {
if (notification) {
if (Platform.OS === 'android') {
const token = await messaging()
.getToken()
.catch(err => {
logger.error('messaging().getToken() failed', err);
return null;
});
if (token) {
await sdk.registerFCMPushTokenForCurrentUser(token);
logger.log('FCM token registered:', token);
} else {
logger.warn('Cannot get FCM token, please check your `android/app/google-services.json`');
}
}
if (Platform.OS === 'ios') {
const token = await messaging()
.getAPNSToken()
.catch(err => {
logger.error('messaging().getAPNSToken() failed', err);
return null;
});
if (token) {
await sdk.registerAPNSPushTokenForCurrentUser(token);
logger.log('APNS token registered:', token);
} else {
logger.warn('Cannot get APNS token, please check your `ios/GoogleService-Info.plist`');
}
}
}
}),
);
Promise.allSettled(postConnect).then(() => {
setTimeout(() => {
navigation.navigate(Routes.ChooseClinic);
}, 500); // 2초 지연 추가
});
} catch (e: any) { // e 타입을 any로 지정
logger.error('Connect failed:', e.name, e.code, e.message);
if (sdk.isCacheEnabled && sdk.currentUser) {
if (isCacheRestrictedError(e)) {
logger.log('Connect failure and getting cache restricted error, clear cache');
sdk.clearCachedData();
} else {
setUser(sdk.currentUser);
logger.log('Connected in offline mode');
}
}
} finally {
setConnecting(false);
}
};
if (loading || connecting) return ;
return null; // 아무 것도 렌더링하지 않음
};
const styles = StyleSheet.create({
container: {
padding: 24,
},
logoContainer: {
justifyContent: ‘center’,
alignItems: ‘center’,
marginVertical: 32,
},
logo: {
width: 220,
height: 50,
},
subtitle: {
color: ‘#999’,
fontSize: 16,
marginVertical: 4,
},
input: {
marginBottom: 12,
},
});
export default ConnectScreen;
[Frequency]
// How frequently is this issue occurring?
EveryTime
[Current impact]
// How is this currently impacting your implementation?
Can’t go to the next page