tauri-plugin-udp

Crates.iotauri-plugin-udp
lib.rstauri-plugin-udp
version0.1.1
sourcesrc
created_at2024-06-04 05:54:39.517629
updated_at2024-10-19 19:24:44.187758
descriptionUDP Socket for Tauri App
homepage
repositoryhttps://github.com/kuyoonjo/tauri-plugin-udp
max_upload_size
id1260754
size20,044
Yu Chen (kuyoonjo)

documentation

README

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
Commit count: 11

cargo fmt