|
|
@@ -23,15 +23,15 @@ implements RPCExporter{
|
|
23
|
23
|
}
|
|
24
|
24
|
]
|
|
25
|
25
|
|
|
26
|
|
- publish = ( topic: string, msg: UpdateType ) => {
|
|
|
26
|
+ publish = async (topic: string, msg: UpdateType ) => {
|
|
27
|
27
|
if(!this.subs[topic]) this.subs[topic] = {}
|
|
28
|
|
- Object.entries(this.subs[topic]).forEach(([uuid, callback]:[string, Function]) => {
|
|
|
28
|
+ await Promise.all(Object.entries(this.subs[topic]).map(async ([uuid, callback]:[string, Function]) => {
|
|
29
|
29
|
try{
|
|
30
|
|
- callback(msg)
|
|
|
30
|
+ await callback(msg)
|
|
31
|
31
|
}catch(e){
|
|
32
|
32
|
delete this.subs[topic][uuid]
|
|
33
|
33
|
}
|
|
34
|
|
- })
|
|
|
34
|
+ }))
|
|
35
|
35
|
}
|
|
36
|
36
|
|
|
37
|
37
|
subscribe = async (topic:string, callback:(p:UpdateType)=>any) : Promise<SubscriptionResponse<{topic: string}>> => {
|