about summary refs log tree commit diff
path: root/streaming/index.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-06 23:46:14 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-06 23:46:14 +0100
commitc8252759df98f41860b0580b029d9efa374c7125 (patch)
treec9dbd102aefe51420c90e8564b435e04ebb266aa /streaming/index.js
parent347a153b3dc73068aedf7510c395cc350a553629 (diff)
Add streaming API channels for local-only statuses
Diffstat (limited to 'streaming/index.js')
-rw-r--r--streaming/index.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 49686b859..e2e8f943e 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -212,11 +212,21 @@ app.get('/api/v1/streaming/public', (req, res) => {
   streamFrom(redisClient, 'timeline:public', req, streamToHttp(req, res, redisClient), true)
 })
 
+app.get('/api/v1/streaming/public/local', (req, res) => {
+  const redisClient = getRedisClient()
+  streamFrom(redisClient, 'timeline:public:local', req, streamToHttp(req, res, redisClient), true)
+})
+
 app.get('/api/v1/streaming/hashtag', (req, res) => {
   const redisClient = getRedisClient()
   streamFrom(redisClient, `timeline:hashtag:${req.params.tag}`, req, streamToHttp(req, res, redisClient), true)
 })
 
+app.get('/api/v1/streaming/hashtag/local', (req, res) => {
+  const redisClient = getRedisClient()
+  streamFrom(redisClient, `timeline:hashtag:${req.params.tag}:local`, req, streamToHttp(req, res, redisClient), true)
+})
+
 wss.on('connection', ws => {
   const location = url.parse(ws.upgradeReq.url, true)
   const token    = location.query.access_token
@@ -238,9 +248,15 @@ wss.on('connection', ws => {
     case 'public':
       streamFrom(redisClient, 'timeline:public', req, streamToWs(req, ws, redisClient), true)
       break;
+    case 'public:local':
+      streamFrom(redisClient, 'timeline:public:local', req, streamToWs(req, ws, redisClient), true)
+      break;
     case 'hashtag':
       streamFrom(redisClient, `timeline:hashtag:${location.query.tag}`, req, streamToWs(req, ws, redisClient), true)
       break;
+    case 'hashtag:local':
+      streamFrom(redisClient, `timeline:hashtag:${location.query.tag}:local`, req, streamToWs(req, ws, redisClient), true)
+      break;
     default:
       ws.close()
     }