arrpc: fix link handling
This commit is contained in:
@@ -26,7 +26,8 @@ const linkCallbacks = new Map<string, LinkCallback>();
|
||||
server.on("activity", (data: any) => {
|
||||
const event: ArRpcEvent = {
|
||||
type: "activity",
|
||||
data: JSON.stringify(data)
|
||||
data: JSON.stringify(data),
|
||||
nonce: randomUUID()
|
||||
};
|
||||
workerPort.postMessage(event);
|
||||
});
|
||||
@@ -43,6 +44,18 @@ const linkCallbacks = new Map<string, LinkCallback>();
|
||||
workerPort.postMessage(event);
|
||||
});
|
||||
|
||||
server.on("link", async (data: any, callback: LinkCallback) => {
|
||||
const nonce = randomUUID();
|
||||
linkCallbacks.set(nonce, callback);
|
||||
|
||||
const event: ArRpcEvent = {
|
||||
type: "link",
|
||||
data,
|
||||
nonce
|
||||
};
|
||||
workerPort.postMessage(event);
|
||||
});
|
||||
|
||||
workerPort.on("message", (e: ArRpcHostEvent) => {
|
||||
switch (e.type) {
|
||||
case "ack-invite": {
|
||||
|
||||
Reference in New Issue
Block a user