mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-09-08 10:10:49 +00:00
Port
This commit is contained in:
@@ -14,12 +14,15 @@ internal class Program
|
||||
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
var epPort = ushort.Parse(
|
||||
Environment.GetEnvironmentVariable("ESIUR_PORT")
|
||||
?? throw new InvalidOperationException("Set ESIUR_PORT before starting the example."));
|
||||
var wh = new Warehouse();
|
||||
|
||||
// Create a store to keep objects.
|
||||
var system = await wh.Put("sys", new MemoryStore());
|
||||
// Create a distibuted server
|
||||
var esiurServer = await wh.Put("sys/server", new EpServer());
|
||||
var esiurServer = await wh.Put("sys/server", new EpServer() { Port = epPort });
|
||||
// Add your object to the store
|
||||
var service = await wh.Put("sys/demo", new Demo());
|
||||
|
||||
@@ -86,7 +89,7 @@ internal class Program
|
||||
// Start your server
|
||||
await wh.Open();
|
||||
|
||||
Console.WriteLine("Running on http://localhost:8888");
|
||||
Console.WriteLine($"Running on http://localhost:8888/?epPort={epPort}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
async function init() {
|
||||
try {
|
||||
const epPort = new URLSearchParams(window.location.search).get("epPort");
|
||||
if (!epPort)
|
||||
throw new Error("Open this example with the application-defined epPort query parameter.");
|
||||
|
||||
connection = await wh.get(`ep://${window.location.hostname}`, {
|
||||
connection = await wh.get(`ep://${window.location.hostname}:${epPort}`, {
|
||||
autoReconnect: true
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user