*add socketExists api method
This commit is contained in:
parent
4e4a22542f
commit
cd33e1508b
|
@ -26,6 +26,7 @@ addHandler("connect", handleConnect);
|
|||
addHandler("listenSocketEvent", handleListenSocketEvent, {
|
||||
receiveUpdates: true,
|
||||
});
|
||||
addHandler("socketExists", handleSocketExists);
|
||||
addHandler("close", handleCloseSocketEvent);
|
||||
addHandler("write", handleWriteSocketEvent);
|
||||
addHandler("addRelay", handleAddRelay);
|
||||
|
@ -149,6 +150,12 @@ function handleListenSocketEvent(aq: ActiveQuery) {
|
|||
});
|
||||
}
|
||||
|
||||
async function handleSocketExists(aq: ActiveQuery) {
|
||||
const { id = null } = aq.callerInput;
|
||||
|
||||
aq.respond(hasDhtConnection(Number(id)));
|
||||
}
|
||||
|
||||
function handleCloseSocketEvent(aq: ActiveQuery) {
|
||||
const socket = validateConnection(aq);
|
||||
|
||||
|
|
Loading…
Reference in New Issue