#tauri #tauri-plugin #plugin

sys tauri-plugin-udp

UDP Socket for Tauri App

2 releases

new 0.1.1 Oct 19, 2024
0.1.0 Jun 4, 2024

#32 in #tauri

Download history 3/week @ 2024-09-18 10/week @ 2024-09-25 7/week @ 2024-10-02 170/week @ 2024-10-16

189 downloads per month

MIT license

8KB
159 lines

tauri-plugin-udp

This plugin only works with Tauri 2.x only.

Install

cargo add tauri-plugin-udp
npm i @kuyoonjo/tauri-plugin-udp

Usage

rust


tauri::Builder::default()
    .plugin(tauri_plugin_udp::init())
    ...

javascript

import { bind, send } from "@kuyoonjo/tauri-plugin-udp";
import { listen } from "@tauri-apps/api/event";

const id = 'unique-id';
await bind(id, '0.0.0.0:8080');
await send(id, '192.168.1.2:9090', 'hello');
await unbind(id);

await listen("plugin://udp", (x) => console.log(x.payload));

permissions

add "udp:default" into "permissions" list of src-tauri\capabilities\default.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  ...
  "permissions": [
    "core:default",
    ...
    "udp:default"
  ]
}

Support

MacOS Linux Windows

Dependencies

~17–58MB
~888K SLoC