2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-06-27 07:13:12 +00:00
This commit is contained in:
2024-06-23 14:10:30 +03:00
parent 408d2237f4
commit 5bd69baa71
11 changed files with 325 additions and 138 deletions

View File

@ -6,6 +6,15 @@
var service;
let $ = document.querySelector;
function authenticator(x)
{
debugger;
let challenge = prompt(x.clue);
if (challenge != null) {
return new Esiur.Core.AsyncReply(parseInt(challenge));
}
}
async function connect(){
let status = document.getElementById("status");
@ -15,7 +24,7 @@
try {
status.innerHTML = "Connecting...";
service = await wh.get("iip://localhost:8001/chat", {username, password: "1234", autoReconnect: true});
service = await wh.get("iip://localhost:8001/sys/chat", {username, password: "1234", autoReconnect: true, authenticator: authenticator});
login.style.display = "none";
service.on("message", appendMessage)
.on(":title", updateTitle)