Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@todesktop/client-comm-server

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@todesktop/client-comm-server

Communicate between the web browser and your desktop app.

  • 0.56.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
615
increased by74.72%
Maintainers
3
Weekly downloads
 
Created
Source

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();

FAQs

Package last updated on 31 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc