fastcomments-sdk
Version:
FastComments API Client - A SDK for interacting with the FastComments API
29 lines • 1.49 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.subscribeToUserFeed = subscribeToUserFeed;
const subscribe_to_changes_js_1 = __importDefault(require("./subscribe-to-changes.js"));
/**
* Subscribe to a user's live events (notifications, mentions, etc.)
* This connects to the user's personal feed stream.
*
* @param config Configuration for the user feed subscription
* @param handleLiveEvent Callback function to handle incoming live events
* @param onConnectionStatusChange Optional callback for connection status changes
* @param lastLiveEventTime Optional timestamp of the last received event
* @returns SubscribeToChangesResult with close() method to terminate the subscription
*/
function subscribeToUserFeed(config, handleLiveEvent, onConnectionStatusChange, lastLiveEventTime) {
const subscribeConfig = {
tenantId: '__internal_profiles',
urlId: `__internal_profiles:${config.userIdWS}`,
apiHost: config.apiHost,
wsHost: config.wsHost,
};
const tenantIdWS = '__internal_profiles';
const urlIdWS = `__internal_profiles:${config.userIdWS}`;
return (0, subscribe_to_changes_js_1.default)(subscribeConfig, tenantIdWS, urlIdWS, config.userIdWS, handleLiveEvent, onConnectionStatusChange, lastLiveEventTime);
}
//# sourceMappingURL=user-feed.js.map