add ability to send and receive channel messages

This commit is contained in:
liamcottle 2025-02-13 22:54:18 +13:00
parent 183bd812fa
commit 37b13d4193
3 changed files with 89 additions and 6 deletions

View file

@ -89,6 +89,9 @@
<button @click="sendCommandSetTxPower" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SetTxPower
</button>
<button @click="sendChannelTextMessage" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SendChannelTxtMessage
</button>
</div>
</div>
@ -284,7 +287,8 @@
await this.connection.sendCommandAddUpdateContact(publicKey, type, flags, outPathLen, outPath, advName, lastAdvert, advLat, advLon);
},
async sendCommandSyncNextMessage() {
await this.connection.sendCommandSyncNextMessage();
const message = await this.connection.syncNextMessage();
console.log("syncNextMessage", message);
},
async sendMessage(contact) {
@ -298,6 +302,17 @@
const response = await this.connection.sendTextMessage(contact.publicKey, message);
console.log(response);
},
async sendChannelTextMessage() {
// ask user for message
const message = prompt("Enter message to send");
if(!message){
return;
}
await this.connection.sendChannelTextMessage(0, message);
},
async resetPath(contact) {