Skip to content

Commit cd3298c

Browse files
authored
fix: cannot connect sometimes when customApiHost is empty (#231)
Connection couldnt be established with no error message when customApiHost and customWebSocketHost were passed as empty string
1 parent d6ef069 commit cd3298c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/lib/dux/sdk/thunks.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,20 @@ export const handleConnection = ({
6262
let sessionHandler = null;
6363
sdkDispatcher({ type: SET_SDK_LOADING, payload: true });
6464
if (userId && appId) {
65-
const newSdk = SendbirdChat.init({
65+
const params = {
6666
appId,
6767
modules: [
6868
new GroupChannelModule(),
6969
new OpenChannelModule(),
7070
],
71-
customApiHost,
72-
customWebSocketHost,
73-
});
71+
};
72+
if (customApiHost) {
73+
params.customApiHost = customApiHost;
74+
}
75+
if (customWebSocketHost) {
76+
params.customWebSocketHost = customWebSocketHost;
77+
}
78+
const newSdk = SendbirdChat.init(params);
7479
if (configureSession && typeof configureSession === 'function') {
7580
sessionHandler = configureSession(newSdk);
7681
}

0 commit comments

Comments
 (0)