Skip to content

Commit dfae025

Browse files
committed
feat: make rtm(LiveQuery) server configable
1 parent b49c468 commit dfae025

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/init.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const fillServerURLs = url => ({
88
stats: url,
99
engine: url,
1010
api: url,
11+
rtm: url,
1112
});
1213

1314
function getDefaultServerURLs(appId) {
@@ -30,6 +31,7 @@ function getDefaultServerURLs(appId) {
3031
stats: `https://${id}.stats.${domain}`,
3132
engine: `https://${id}.engine.${domain}`,
3233
api: `https://${id}.api.${domain}`,
34+
rtm: `https://${id}.rtm.${domain}`,
3335
};
3436
}
3537

@@ -38,10 +40,11 @@ let _disableAppRouter = false;
3840
/**
3941
* URLs for services
4042
* @typedef {Object} ServerURLs
41-
* @property {String} [api] serverURL for api service
43+
* @property {String} [api] serverURL for API service
4244
* @property {String} [engine] serverURL for engine service
4345
* @property {String} [stats] serverURL for stats service
4446
* @property {String} [push] serverURL for push service
47+
* @property {String} [rtm] serverURL for LiveQuery service
4548
*/
4649

4750
/**
@@ -102,9 +105,14 @@ AV.init = function init(options, ...params) {
102105
if (realtime) {
103106
AV._config.realtime = realtime;
104107
} else if (AV._sharedConfig.liveQueryRealtime) {
108+
const { api, rtm } = AV._config.serverURLs;
105109
AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
106110
appId,
107111
appKey,
112+
server: {
113+
api,
114+
RTMRouter: rtm,
115+
},
108116
});
109117
}
110118
};

storage.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ interface ServerURLs {
11461146
engine?: string;
11471147
stats?: string;
11481148
push?: string;
1149+
rtm?: string;
11491150
}
11501151

11511152
export function init(options: {

0 commit comments

Comments
 (0)