-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
As mentioned in the title - there is no way:
- to reject receiving an action payload (for instance, peer might want to reject huge blobs)
- cancel any ongoing action transmission (for instance, peer might want to cancel ongoing file transmission if it's too big or sent by mistake)
Is it by design?
P.S. The first issue can be solved by additional pair of actions to perform a handshake:
const [sendFile, onFileReceived] = room.makeAction('file');
const [ask, onRequest] = room.makeAction('request');
const [respond, onResponse] = room.makeAction('response');
onRequest((request, peerId) => {
const shouldReject = banned.has(peerId) || request.size > MAX_SIZE;
respond({ reqId: request.id, result: shouldReject ? 'reject' : 'accept' }, peerId);
});
onResponse((response, peerId) => {
if (response.result === 'accept') sendFile(requestsMap[response.reqId].file, peerId);
else if (response.result === 'reject') requestsMap.delete(response.reqId);
});Metadata
Metadata
Assignees
Labels
No labels