Skip to content

Commit 69ab721

Browse files
authored
feat: accept customApiHost & customWebSocketHost (#215)
Accept customApiHost & customWebSocketHost on SendbirdProvider and App These urls let the SDK to connect to custom domains fixes: https://sendbird.atlassian.net/browse/UIKIT-1853
1 parent ce16fbf commit 69ab721

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

scripts/index_d_ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
appId: string;
1818
userId: string;
1919
accessToken?: string;
20+
customApiHost?: string,
21+
customWebSocketHost?: string,
2022
theme?: 'light' | 'dark';
2123
userListQuery?(): UserListQuery;
2224
nickname?: string;
@@ -175,6 +177,8 @@
175177
appId: string;
176178
accessToken?: string;
177179
configureSession?: (sdk: SendbirdGroupChat | SendbirdOpenChat) => SessionHandler;
180+
customApiHost?: string,
181+
customWebSocketHost?: string,
178182
children?: React.ReactNode;
179183
theme?: 'light' | 'dark';
180184
nickname?: string;

src/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ interface SendBirdProviderProps {
8787
appId: string;
8888
accessToken?: string;
8989
configureSession?: (sdk: SendbirdChat) => SessionHandler;
90+
customApiHost?: string,
91+
customWebSocketHost?: string,
9092
children?: React.ReactNode;
9193
theme?: 'light' | 'dark';
9294
nickname?: string;
@@ -252,6 +254,8 @@ interface AppProps {
252254
appId: string;
253255
userId: string;
254256
accessToken?: string;
257+
customApiHost?: string,
258+
customWebSocketHost?: string,
255259
theme?: 'light' | 'dark';
256260
userListQuery?(): UserListQuery;
257261
nickname?: string;

src/lib/Sendbird.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export default function Sendbird(props) {
2929
appId,
3030
accessToken,
3131
configureSession,
32+
customApiHost,
33+
customWebSocketHost,
3234
children,
3335
disableUserProfile,
3436
renderUserProfile,
@@ -73,6 +75,8 @@ export default function Sendbird(props) {
7375
nickname,
7476
profileUrl,
7577
configureSession,
78+
customApiHost,
79+
customWebSocketHost,
7680
sdk: sdkStore.sdk,
7781
logger,
7882
}, {
@@ -194,6 +198,8 @@ Sendbird.propTypes = {
194198
userId: PropTypes.string.isRequired,
195199
appId: PropTypes.string.isRequired,
196200
accessToken: PropTypes.string,
201+
customApiHost: PropTypes.string,
202+
customWebSocketHost: PropTypes.string,
197203
configureSession: PropTypes.func,
198204
children: PropTypes.oneOfType([
199205
PropTypes.element,
@@ -244,6 +250,8 @@ Sendbird.propTypes = {
244250

245251
Sendbird.defaultProps = {
246252
accessToken: '',
253+
customApiHost: null,
254+
customWebSocketHost: null,
247255
configureSession: null,
248256
theme: 'light',
249257
nickname: '',

src/lib/dux/sdk/thunks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export const handleConnection = ({
4343
profileUrl,
4444
accessToken,
4545
configureSession,
46+
customApiHost,
47+
customWebSocketHost,
4648
sdk,
4749
logger,
4850
}, dispatchers) => {
@@ -66,6 +68,8 @@ export const handleConnection = ({
6668
new GroupChannelModule(),
6769
new OpenChannelModule(),
6870
],
71+
customApiHost,
72+
customWebSocketHost,
6973
});
7074
if (configureSession && typeof configureSession === 'function') {
7175
sessionHandler = configureSession(newSdk);

src/smart-components/App/index.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export default function App(props) {
2020
appId,
2121
userId,
2222
accessToken,
23+
customApiHost,
24+
customWebSocketHost,
2325
theme,
2426
userListQuery,
2527
nickname,
@@ -54,6 +56,8 @@ export default function App(props) {
5456
appId={appId}
5557
userId={userId}
5658
accessToken={accessToken}
59+
customApiHost={customApiHost}
60+
customWebSocketHost={customWebSocketHost}
5761
theme={theme}
5862
nickname={nickname}
5963
profileUrl={profileUrl}
@@ -152,6 +156,8 @@ App.propTypes = {
152156
appId: PropTypes.string.isRequired,
153157
userId: PropTypes.string.isRequired,
154158
accessToken: PropTypes.string,
159+
customApiHost: PropTypes.string,
160+
customWebSocketHost: PropTypes.string,
155161
theme: PropTypes.string,
156162
userListQuery: PropTypes.func,
157163
nickname: PropTypes.string,
@@ -193,6 +199,8 @@ App.propTypes = {
193199

194200
App.defaultProps = {
195201
accessToken: '',
202+
customApiHost: '',
203+
customWebSocketHost: '',
196204
theme: 'light',
197205
nickname: '',
198206
profileUrl: '',

src/smart-components/App/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default interface AppProps {
1212
appId: string;
1313
userId: string;
1414
accessToken?: string;
15+
customApiHost?: string,
16+
customWebSocketHost?: string,
1517
theme?: 'light' | 'dark';
1618
userListQuery?(): UserListQuery;
1719
nickname?: string;

0 commit comments

Comments
 (0)