# @yealink_dev/yealink-ipc-helper-rcc

> Makes @yealink_dev/yealink-node-sdk-rcc available for Electron's renderer process

Latest version **1.0.5** (published 2025-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yealink_dev/yealink-ipc-helper-rcc
pnpm add @yealink_dev/yealink-ipc-helper-rcc
yarn add @yealink_dev/yealink-ipc-helper-rcc
bun add @yealink_dev/yealink-ipc-helper-rcc
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2025-12-01 |
| First published | 2022-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 77.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yealink |
| Maintainers | yealinkdevs |
| Keywords | yealink, electron |

## Links

- npm: https://www.npmjs.com/package/@yealink_dev/yealink-ipc-helper-rcc
- npm.io page: https://npm.io/package/@yealink_dev/yealink-ipc-helper-rcc

## Dependencies (1)

- [@yealink_dev/yealink-node-sdk-rcc](https://npm.io/package/@yealink_dev/yealink-node-sdk-rcc.md) ^1.0.5

## Recent versions

- 1.0.5 (latest) — 2025-12-01
- 1.0.4 — 2025-08-15
- 1.0.3 — 2025-05-28
- 1.0.2 — 2025-04-03
- 1.0.1 — 2023-04-28
- 1.0.0 — 2022-07-11

## README

# Yealink Node.js Electron Renderer Helper

This optional package allows a secure render process in ElectronJs (https://electronjs.org/) to transparently access the full [Yealink Node.js SDK](../nodesdk/README.md) API through proxies implemented on top of Electron's IPC mechanism. This makes it much easier for a sandboxed render process to call into Yealink classes without having to pass messages around.

*Note that this package is optional and only potentially useful in a sandboxed electron setup, where the render process does not have access rights to call into the node modules such as the Yealink Node.js API npm module. Even in this case this package is optional, as electron applications can perfectly decide to manage any such messaging themselves.*

# Usage tips

1. Get a [Yealink API Key] from yealink teams

2. Install dependencies to your existing electron project

    ```npm
    npm install yealink-node-sdk
    npm install yealink-ipc-helper
    ```

3. Configure your existing MAIN process script

    Add a top level imports and global:

    ```typescript
    import { app, BrowserWindow, ipcMain } from 'electron';
    import { ConfigParamsCloud } from '@yealink_dev/yealink-node-sdk-rcc';
    import { YLIPCServerFactory, YLIPCServer } from '@yealink_dev/yealink-ipc-helper-rcc';

    let ylIPCServerFactory: YLIPCServerFactory | null = null;
    let ylIPCServer: YLIPCServer | null = null;
    ```

    Add a preload script to your BrowserWindow instantiation if it is missing:
      
    ```typescript
    preload: path.join(__dirname, 'preload.js')
    ```

    Setup yealink api server when electron is ready:

    ```typescript
    app.on("ready", async () => {
      // Setup the yealink server factory BEFORE creating GUI.
      ylIPCServerFactory = new YLIPCServerFactory(ipcMain);

      // Code to create GUI window here
      // Tip: Return window.loadFile promise or wait for 'did-finish-load' event and convert it to a promise.
      let fullyLoadedWindow = await your_code_to_create_gui_that_resolves_when_loaded();

      // As window is now fully loaded we can instantiate our api server for the client.
      ylIPCServer = await ylIPCServerFactory.create('<Set your Yealink API key here>', 
                                                    { /* config here if needed */}, 
                                                    false,
                                                    fullyLoadedWindow);
    });
    ```

    Cleanup when closing:
    ```typescript
    app.on("window-all-closed", async () => {
        if (process.platform !== "darwin") {
            if (ylIPCServer) {
                await ylIPCServer.shutdown();
                ylIPCServer = null;
            }
            if (app) {
                app.quit();
            }
        }
    });
    ```

4. Configure the preload script to expose ipcRender to the renderer process

    ```typescript
    import { ipcRenderer } from 'electron';

    window.electron = { 
        ipcRenderer
    };
    ```

5. Configure to your render javascript (loaded by your html)

    ```typescript
    import { createIPCClient } from '@yealink_dev/yealink-ipc-helper-rcc';
    import { DeviceImpl, YLSdkImpl, ylEventsList, DeviceEventsList } from '@yealink_dev/yealink-node-sdk-rcc';

    createIPCClient(window.electron.ipcRenderer).then((client) => {    
        client.on('attach', (device) => {
            // TODO: Add code here to call into provided DeviceImpl proxy. 
        });

        client.on('detach', (device) => {
        // TODO: Add code here if needed.
        });
    }).catch( (err) => {
        console.error("Could not initialize Yealink Api client : " + err);
    });
    ```


6. Use typescript along with browserify, webpack or other build tool to produce a javascript bundle for the renderer.

# Complete example and details.

Refer to the [democallcontrol](../democallcontrol/README.md) for a complete example of how to use this package.

---
_Source: https://npm.io/package/@yealink_dev/yealink-ipc-helper-rcc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
