0.55.0 • Published 7 months ago

@todesktop/plugin-comm-server v0.55.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

ToDesktop Communication Server

Communicate between the web browser and your desktop app.

Installation

Install @todesktop/client-comm-server in your client-side application using

npm install @todesktop/client-comm-server

Installation of the plugin package is also necessary. Using ToDesktop Builder, navigate to Plugins. Click on the Explore button for "Communication Server" and install the package.

Usage

checkIfCommServerRunning

Checks to see if the communication server is currently running. This should be executed from the context of the web app attempting communication with a local desktop app.

import { checkIfCommServerRunning } from "@todesktop/client-comm-server";

const ports = [20001, 39214];
checkIfCommServerRunning(ports).then(async (isRunning) => {
  console.log(isRunning); // true
});

broadcast

Broadcasts a message to the running desktop app.

import { broadcast } from "@todesktop/client-comm-server";

const ports = [20001, 39214];

const res = await broadcast(ports, { foo: "bar" });

console.log(res);

handleBroadcast

Listens to messages that have been forwarded from the communication server.

import { handleBroadcast } from "@todesktop/client-comm-server";

const unsubscribe = handleBroadcast((data) => {
  console.log(data);
  return "acknowledged";
});

// ...later
unsubscribe();
0.55.0

7 months ago

0.53.0

12 months ago

0.54.0

12 months ago

0.52.0

12 months ago

0.42.0

2 years ago

0.43.0

2 years ago

0.41.0

2 years ago

0.40.0

2 years ago

0.39.0

2 years ago

0.38.0

2 years ago

0.37.0

2 years ago

0.36.0

2 years ago

0.35.0

2 years ago

0.34.0

2 years ago

0.33.0

2 years ago

0.32.0

2 years ago

0.31.0

2 years ago

0.30.0

2 years ago

0.27.0

2 years ago

0.26.0

2 years ago