Skip to content

Commit 6d12d44

Browse files
authored
Feature/triage (#5)
* wip * wip * wip * pub/sub minimum almost working * updated threads * wip * wip * wip * tested 100k+ set size and elastic * wip * wip * wip * wip * wip * wp * wp * wip * added www * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
1 parent bb7f9dc commit 6d12d44

File tree

2 files changed

+100
-38
lines changed

2 files changed

+100
-38
lines changed

Diff for: README.md

+99-37
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
# Messaging Exchange and Event Bus for Node.js & Python
1+
# Messaging Exchange and Event Bus for Node.js & Reports in Python, PySpark
2+
3+
Subsystem of the SFPL growth and experimentation framework.
24

35
### 🔴 Important 🔴
46
```diff
57
- This project is a work in progress. Please come back shortly.
68
```
79
## Design
810

9-
Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner, msgs], [option Realtime, Nearline, scheduled, failed], [capture,reporting,recall])
11+
**Essentially this is Optimizely for messaging**
12+
13+
Tracking messaging like we do the rest of internet traffic is essential to understanding our customers and optimizing growth. Messaging exchange (MSGXC) is a central system for dispatching and tracking all messgaing (currently supports iOS native, Android native, SMS, Email, Websockets, WebPush Notifications).
1014

1115
### Components
1216

1317
* Realtime
14-
* Websockets (Socket.io, uWebSockets)
18+
* Websockets
1519
* Web Notifications
1620
* Native Messaging
1721
* Nearline
@@ -25,7 +29,7 @@ Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner,
2529
* Native messaging receipts
2630
* Offline
2731
* PySpark Reports
28-
* Scheduler
32+
* Scheduler
2933

3034

3135
### Urgency
@@ -41,7 +45,9 @@ Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner,
4145

4246
Run ```docker-compose up``` in the root of this project to get elassandra (cassandra with elastic search), and NATS.io working.
4347

44-
### API
48+
## API
49+
50+
### User Functions
4551

4652
#### GETs
4753

@@ -57,6 +63,91 @@ Checks whether the server is up.
5763
```200```
5864

5965

66+
#### POSTs
67+
68+
##### Enlist
69+
_Requires Any JWT_
70+
```
71+
/api/v1/enlist
72+
```
73+
74+
Enlists a user's devices including web-browsers, native android/os, to receive messages.
75+
76+
**Request body:**
77+
```
78+
{"os": "ios", "token": "ad62ea6ea23d6974871cf59a06cbdb2783b85adbafe3355c0007362249d3e75c"}
79+
80+
*or*
81+
82+
{"os": "android", "token": "e_nslPZejyM:APA91bHR-znf4EuSIKeY9dzlX4cupXA5cdsW1SzOHUFRrsteaL5WDuzsh_cnpVpQC3IPcewl_v3N0kbArC67UTEW_ENt5Ej5Sn0qi1RoRHv5beLNi9y4OzZ__T3SH3tW5gwqxn2Hap01"}
83+
84+
*or*
85+
86+
{
87+
endpoint: 'https://fcm.googleapis.com/fcm/send/czVGxJOoycA:APA91bGZt8FZU2fEAnDCr1PdRb7HDtayoGDUO1dy6vjTu1sDKhGAAB0i2nXw_jGKhnzmh5rmK4klsyaRQaUpM0oS0VYGBCTTpF-nkP67UEW7BX9o7vNatcPuiG-yHa75hXE80B5F7DNi',
88+
expirationTime: null,
89+
keys: {
90+
p256dh: 'BN81HfHxzt4V4lXDV_2ia8Rl_QvqofvoNI7_MOHCiOMEYuFXFNDBOJzKCCj2nzK5luwnH6rvBCN2jx7lNHpraaw',
91+
auth: '0ywNrBxQ-rm4skkHDJB5lw'
92+
}
93+
}
94+
```
95+
96+
**Correct Response:**
97+
```true```
98+
99+
##### Publish
100+
_Requires Any JWT_
101+
```
102+
/api/v1/publish
103+
```
104+
105+
Publish a message to a thread (this sends a message to the mthread).
106+
107+
**Request body:**
108+
```
109+
{"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130", "msg":"the message you want to send", "opts", { }}
110+
```
111+
112+
**Correct Response:**
113+
```true```
114+
115+
116+
##### Subscribe
117+
_Requires Any JWT_
118+
```
119+
/api/v1/subscribe
120+
```
121+
122+
Subscribe a user to a thread (this adds a user to the subs column in mthreads).
123+
124+
**Request body:**
125+
```
126+
{"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130"}
127+
```
128+
129+
**Correct Response:**
130+
```true```
131+
132+
133+
##### Unubscribe
134+
_Requires Any JWT_
135+
```
136+
/api/v1/unsubscribe
137+
```
138+
139+
Unsubscribe a user from a thread (this removes a user from the subs column in mthreads).
140+
141+
**Request body:**
142+
```
143+
{"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130"}
144+
```
145+
146+
**Correct Response:**
147+
```true```
148+
149+
### Admin Functions
150+
60151
#### POSTs
61152

62153
##### BROADCAST
@@ -96,7 +187,7 @@ opts _Optional_
96187
```true```
97188

98189
##### SEND
99-
_Requires Any JWT_
190+
_Requires Admin JWT_
100191
```
101192
/api/v1/send
102193
```
@@ -114,39 +205,10 @@ opts _Optional_
114205
**Correct Response:**
115206
```true```
116207

117-
##### SUBSCRIBE-NATIVE
118-
_Requires Any JWT_
119-
```
120-
/api/v1/native/subscribe
121-
```
122-
123-
Subscribes a user to native messaging using their current device.
124-
125-
**Request body:**
126-
```
127-
{"os": "ios", "token": "ad62ea6ea23d6974871cf59a06cbdb2783b85adbafe3355c0007362249d3e75c"}
128-
129-
or
130-
131-
{"os": "android", "token": "e_nslPZejyM:APA91bHR-znf4EuSIKeY9dzlX4cupXA5cdsW1SzOHUFRrsteaL5WDuzsh_cnpVpQC3IPcewl_v3N0kbArC67UTEW_ENt5Ej5Sn0qi1RoRHv5beLNi9y4OzZ__T3SH3tW5gwqxn2Hap01"}
132-
133-
or
134-
135-
{
136-
endpoint: 'https://fcm.googleapis.com/fcm/send/czVGxJOoycA:APA91bGZt8FZU2fEAnDCr1PdRb7HDtayoGDUO1dy6vjTu1sDKhGAAB0i2nXw_jGKhnzmh5rmK4klsyaRQaUpM0oS0VYGBCTTpF-nkP67UEW7BX9o7vNatcPuiG-yHa75hXE80B5F7DNi',
137-
expirationTime: null,
138-
keys: {
139-
p256dh: 'BN81HfHxzt4V4lXDV_2ia8Rl_QvqofvoNI7_MOHCiOMEYuFXFNDBOJzKCCj2nzK5luwnH6rvBCN2jx7lNHpraaw',
140-
auth: '0ywNrBxQ-rm4skkHDJB5lw'
141-
}
142-
}
143-
```
144-
145-
**Correct Response:**
146-
```true```
147-
148208
## TODO
149209

210+
- [ ] Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner, msgs], [option Realtime, Nearline, scheduled, failed], [tracking,capture,reporting,recall])
211+
- [ ] Scheduler
150212
- [ ] Processing in batches
151213
- [ ] Multicast using elastic search (instead of slower CQL)
152214
- [x] Add web notifications and SMS (Amazon/Twilio)

Diff for: xcs/pods/messaging/thread/model.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Threading {
119119

120120
//////////////////////////
121121
//SEND OTHERS
122-
//TODO: Triage
122+
//TODO: Triage!
123123
//TODO: Add retries for realtime
124124
//TODO: ScheduleDegraded() and include nearline messaging emd, emm , emw (email summaries)
125125
notified.push(thread.subs[i]);

0 commit comments

Comments
 (0)