*Add api method to create swarms

This commit is contained in:
Derrick Hammer 2023-04-15 03:57:34 -04:00
parent 2832694cd5
commit ba38f7670f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,7 @@ addHandler("createProtomuxChannel", createProtomuxChannel, {
addHandler("createProtomuxMessage", createProtomuxMessage, {
receiveUpdates: true,
});
addHandler("createSwarm", handleCreateSwarm);
async function handlePresentSeed(aq: ActiveQuery) {
const pubkey = await ed.getPublicKey(aq.callerInput.rootKey);
@ -589,6 +590,10 @@ async function createProtomuxMessage(aq: ActiveQuery) {
});
}
async function handleCreateSwarm(aq: ActiveQuery) {
aq.respond(await createSwarm());
}
function getSwarmToSocketConnectionId(socket: any) {
for (const conn of connections) {
if (conn[1].conn === socket) {