2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-06-27 07:13:12 +00:00

Instance.Link

This commit is contained in:
2022-08-13 04:00:26 +03:00
parent 1985363ad7
commit 2689bb7fd5
12 changed files with 1595 additions and 829 deletions

View File

@ -13,6 +13,9 @@ import TypedMap from "../../src/Data/TypedMap.js";
const require = createRequire(import.meta.url);
const WebSocket = require('ws');
const http = require("http");
const fs = require("fs");
@ -65,14 +68,15 @@ class MyChat extends IResource {
}
let x = TransmissionType.compose(TransmissionTypeIdentifier.List, new DC([1,2,3,4,5,6]));
let tt = TransmissionType.parse(x, 0, x.length);
let sys = await Warehouse.new(MemoryStore, "sys");
let ms = await Warehouse.new(MyMembership, "ms");
let chat = await Warehouse.new(MyChat, "chat", sys);
server = await Warehouse.new(DistributedServer, "dss", sys, null, null, {membership: ms, entryPoint: chat});
wss.on('connection', function connection(ws)
{
let con = server.add();
@ -97,5 +101,6 @@ http.createServer(function (req, res) {
});
}).listen(8000);
console.log(`HTTP Server running http://localhost:8000/demo/chat/index.html`);
console.log(`IIP Server running iip://localhost:8001`);

View File

@ -15,7 +15,7 @@
try {
status.innerHTML = "Connecting...";
service = await wh.get("iip://localhost:8001/chat", {username, password: "1234"});
service = await wh.get("iip://localhost:8001/chat", {username, password: "1234", autoReconnect: true});
login.style.display = "none";
service.on("message", appendMessage)
.on(":title", updateTitle)