Added streaming of updated status from fetch_link_card_service

Sends updated status down after adding/updating/removing preview card.
This commit is contained in:
mgabdev
2019-08-28 01:26:34 -04:00
parent dc87184ef0
commit 31d4660947
3 changed files with 52 additions and 3 deletions

View File

@@ -534,6 +534,11 @@ const startWorker = (workerId) => {
app.use(authenticationMiddleware);
app.use(errorMiddleware);
app.get('/api/v1/streaming/statuscard', (req, res) => {
const channel = `statuscard`;
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req, subscriptionHeartbeat(channel)));
});
app.get('/api/v1/streaming/user', (req, res) => {
const channel = `timeline:${req.accountId}`;
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req, subscriptionHeartbeat(channel)));
@@ -608,6 +613,10 @@ const startWorker = (workerId) => {
let channel;
switch(location.query.stream) {
case 'statuscard':
channel = `statuscard`;
streamFrom(channel, req, streamToWs(req, ws), streamWsEnd(req, ws, subscriptionHeartbeat(channel)));
break;
case 'user':
channel = `timeline:${req.accountId}`;
streamFrom(channel, req, streamToWs(req, ws), streamWsEnd(req, ws, subscriptionHeartbeat(channel)));