Skip to content

Commit

Permalink
Merge pull request #140 from Qsilver97/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Qsilver97 authored May 27, 2024
2 parents 09ad4a8 + 9a98e49 commit da461af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 41 deletions.
38 changes: 0 additions & 38 deletions app/client/src/components/dashboard/modal/TxFormsModal.tsx

This file was deleted.

24 changes: 21 additions & 3 deletions app/server/controllers/liveSocketController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@ const socketManager = require('../managers/socketManager');
const stateManager = require('../managers/stateManager');
const { setRemoteSubshash } = require('../managers/stateManager');
const wasmManager = require('../managers/wasmManager');
const { splitAtFirstSpace } = require('../utils/helpers');
const { splitAtFirstSpace, socketSync } = require('../utils/helpers');

module.exports = function (liveSocketURL) {
let liveSocket;
let reconnectingStatus = false;

const connect = () => {
liveSocket = socketManager.initLiveSocket(liveSocketURL);

liveSocket.on('open', (client) => {
console.log(client)
liveSocket.on('open', () => {
console.log("Connected to the live socket");
const init = async () => {
const userState = stateManager.getUserState();
let realPassword = userState.password;
listResult = await wasmManager.ccall({ command: `list ${realPassword}`, flag: 'login' });
const addresses = listResult.value.display.addresses;
await socketSync(addresses[0]);
const hexResult = await wasmManager.ccall({ command: `logintx ${realPassword}`, flag: 'logintx' });
await socketSync(hexResult.value.display);
reconnectingStatus = false;
for (idx = 1; idx < addresses.length; idx++) {
if (addresses[idx] && addresses[idx] != "") {
liveSocket.send(addresses[idx]);
}
}
}
if (reconnectingStatus)
init();
});

liveSocket.on('error', (error) => {
Expand Down Expand Up @@ -46,6 +63,7 @@ module.exports = function (liveSocketURL) {

liveSocket.on('close', () => {
console.log("Disconnected from the server. Attempting to reconnect...");
reconnectingStatus = true;
setTimeout(connect, 1000); // Attempt to reconnect after 1 seconds
});
};
Expand Down

0 comments on commit da461af

Please sign in to comment.