New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@deskthing/client

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deskthing/client

The Deskthing connector for the client webapps

latest
Source
npmnpm
Version
0.11.2
Version published
Weekly downloads
19
18.75%
Maintainers
1
Weekly downloads
 
Created
Source

DeskThing Client NPM

The DeskThing-App is one of two required modules needed to make your own DeskThing App. It serves as a communication layer between your webpage and the rest of the client.

Installation

To install the client, use the following command:

npm install deskthing-client

Usage

Initializing the DeskThing Client

To use the DeskThing client in your application, you need to import it and get an instance:

import DeskThing from 'deskthing-client';

const deskThing = DeskThing.getInstance();

Sending Messages to the Server

You can send messages to the server using the send method. For example, to send a JSON object to the server:

deskThing.send({ type: 'set', payload: examplePayload });

Receiving Messages on the Server

On the server side, you need to import the DeskThing server module and listen for events:

import DeskThing from 'deskthing-server';

const deskThing = DeskThing.getInstance();

deskThing.on('set', (socketData) => {
console.log(socketData.payload);
});

Example: Two-Way Communication

Here is a more complete example demonstrating two-way communication between the client and server:

Client Side

import DeskThing from 'deskthing-client';

const deskThing = DeskThing.getInstance();

// Sending a message to the server
deskThing.send({ type: 'set', payload: { key: 'value' } });

// Listening for a response from the server
deskThing.on('response', (data) => {
  console.log('Received response from server:', data);
});

Server Side

import DeskThing from 'deskthing-server';

const deskThing = DeskThing.getInstance();

// Listening for a 'set' message from the client
deskThing.on('set', (socketData) => {
  console.log('Received payload:', socketData.payload);

  // Sending a response back to the client
  deskThing.sendDataToClient(socketData.socketId, {
    type: 'response',
    payload: { message: 'Data received successfully' }
  });
});

Additional Information

For more detailed examples and intended implementations, please refer to the apps located at https://github.com/itsriprod/deskthing-apps

Keywords

deskthing

FAQs

Package last updated on 10 Jul 2025

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