diff --git a/src/modules/dApps/controller.ts b/src/modules/dApps/controller.ts index de33f4f68..d21481934 100644 --- a/src/modules/dApps/controller.ts +++ b/src/modules/dApps/controller.ts @@ -28,7 +28,7 @@ export class DappController { async connect({ body }: ICreateRequest) { try { - const { vaultId, sessionId, name, origin, userAddress } = body; + const { vaultId, sessionId, name, origin, userAddress, request_id } = body; const predicate = await new PredicateService().findById(vaultId); let dapp = await new DAppsService().findBySessionID(sessionId, origin); const user = await User.findOne({ where: { address: userAddress } }); @@ -50,11 +50,12 @@ export class DappController { } dapp.currentVault = predicate; await dapp.save(); - + //console.log('[api]: ', dapp, sessionId, request_id); const socket = new SocketClient(sessionId, origin); socket.sendMessage({ - room: sessionId, + sessionId, to: '[CONNECTOR]', + request_id, type: '[AUTH_CONFIRMED]', data: { connected: true, diff --git a/src/modules/dApps/types.ts b/src/modules/dApps/types.ts index 65626b0aa..d16137fb6 100644 --- a/src/modules/dApps/types.ts +++ b/src/modules/dApps/types.ts @@ -32,6 +32,7 @@ interface ICreateRequestSchema extends ValidatedRequestSchema { > & { vaultId: string; userAddress: string; + request_id: string; }; [ContainerTypes.Headers]: { origin: string; diff --git a/src/socket/client.ts b/src/socket/client.ts index b1d5a1179..0db050623 100644 --- a/src/socket/client.ts +++ b/src/socket/client.ts @@ -1,10 +1,11 @@ import { io, Socket } from 'socket.io-client'; interface IMessage { - room: string; // sessionId + sessionId: string; // sessionId to: string; // username -> recebe a mensagem '[UI]' por exemplo type: string; // tipo da mensagem/evento data: { [key: string]: any }; + request_id: string; } export class SocketClient {