Compare commits
2 Commits
2832694cd5
...
402508ca64
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 402508ca64 | |
Derrick Hammer | ba38f7670f |
13
src/index.ts
13
src/index.ts
|
@ -75,12 +75,13 @@ addHandler("socketListenEvent", handleSocketListenEvent, {
|
||||||
});
|
});
|
||||||
addHandler("socketWrite", handleWriteSocketEvent);
|
addHandler("socketWrite", handleWriteSocketEvent);
|
||||||
addHandler("socketClose", handleCloseSocketEvent);
|
addHandler("socketClose", handleCloseSocketEvent);
|
||||||
addHandler("createProtomuxChannel", createProtomuxChannel, {
|
addHandler("createProtomuxChannel", handleCreateProtomuxChannel, {
|
||||||
receiveUpdates: true,
|
receiveUpdates: true,
|
||||||
});
|
});
|
||||||
addHandler("createProtomuxMessage", createProtomuxMessage, {
|
addHandler("createProtomuxMessage", handleCreateProtomuxMessage, {
|
||||||
receiveUpdates: true,
|
receiveUpdates: true,
|
||||||
});
|
});
|
||||||
|
addHandler("createSwarm", handleCreateSwarm);
|
||||||
|
|
||||||
async function handlePresentSeed(aq: ActiveQuery) {
|
async function handlePresentSeed(aq: ActiveQuery) {
|
||||||
const pubkey = await ed.getPublicKey(aq.callerInput.rootKey);
|
const pubkey = await ed.getPublicKey(aq.callerInput.rootKey);
|
||||||
|
@ -425,7 +426,7 @@ async function handleGetSocketInfo(aq: ActiveQuery) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createProtomuxChannel(aq: ActiveQuery) {
|
async function handleCreateProtomuxChannel(aq: ActiveQuery) {
|
||||||
const socket = validateConnection(aq);
|
const socket = validateConnection(aq);
|
||||||
|
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
|
@ -488,7 +489,7 @@ async function createProtomuxChannel(aq: ActiveQuery) {
|
||||||
aq.sendUpdate(channelId);
|
aq.sendUpdate(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createProtomuxMessage(aq: ActiveQuery) {
|
async function handleCreateProtomuxMessage(aq: ActiveQuery) {
|
||||||
const socket = validateConnection(aq);
|
const socket = validateConnection(aq);
|
||||||
|
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
|
@ -589,6 +590,10 @@ async function createProtomuxMessage(aq: ActiveQuery) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleCreateSwarm(aq: ActiveQuery) {
|
||||||
|
aq.respond(await createSwarm());
|
||||||
|
}
|
||||||
|
|
||||||
function getSwarmToSocketConnectionId(socket: any) {
|
function getSwarmToSocketConnectionId(socket: any) {
|
||||||
for (const conn of connections) {
|
for (const conn of connections) {
|
||||||
if (conn[1].conn === socket) {
|
if (conn[1].conn === socket) {
|
||||||
|
|
Loading…
Reference in New Issue