put faucet message right after socket connection
This commit is contained in:
parent
92ff48c9da
commit
9e327f6c08
@ -55,12 +55,6 @@ async function init(): Promise<boolean> {
|
|||||||
await services.restoreProcesses();
|
await services.restoreProcesses();
|
||||||
await services.restoreMessages();
|
await services.restoreMessages();
|
||||||
|
|
||||||
const amount = await services.getAmount();
|
|
||||||
|
|
||||||
if (amount === 0n) {
|
|
||||||
const faucetMsg = await services.createFaucetMessage();
|
|
||||||
await services.sendFaucetMessage(faucetMsg);
|
|
||||||
}
|
|
||||||
if (services.isPaired()) {
|
if (services.isPaired()) {
|
||||||
isPaired = true;
|
isPaired = true;
|
||||||
console.log("🚀 ~ setTimeout ~ isPaired:", isPaired)
|
console.log("🚀 ~ setTimeout ~ isPaired:", isPaired)
|
||||||
|
@ -13,6 +13,12 @@ class WebSocketClient {
|
|||||||
this.ws.onopen = async (event) => {
|
this.ws.onopen = async (event) => {
|
||||||
console.log('WebSocket connection established');
|
console.log('WebSocket connection established');
|
||||||
|
|
||||||
|
const amount = await services.getAmount();
|
||||||
|
|
||||||
|
if (amount === 0n) {
|
||||||
|
const faucetMsg = await services.createFaucetMessage();
|
||||||
|
await services.sendFaucetMessage(faucetMsg);
|
||||||
|
}
|
||||||
while (this.messageQueue.length > 0) {
|
while (this.messageQueue.length > 0) {
|
||||||
const message = this.messageQueue.shift();
|
const message = this.messageQueue.shift();
|
||||||
if (message) {
|
if (message) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user