multiAI Summary Pending

tauri-app-websocket

Establish WebSocket connections from the Rust side using the Tauri v2 websocket plugin, bypassing WebView limitations. Use when implementing real-time messaging, managing WebSocket connection lifecycle, or configuring host allowlists for secure connections.

223 stars

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tauri-app-websocket/SKILL.md --create-dirs "https://raw.githubusercontent.com/partme-ai/full-stack-skills/main/skills/tauri-skills/tauri-app-websocket/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tauri-app-websocket/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tauri-app-websocket Compares

Feature / Agenttauri-app-websocketStandard Approach
Platform SupportmultiLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Establish WebSocket connections from the Rust side using the Tauri v2 websocket plugin, bypassing WebView limitations. Use when implementing real-time messaging, managing WebSocket connection lifecycle, or configuring host allowlists for secure connections.

Which AI agents support this skill?

This skill is compatible with multi.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

## When to use this skill

**ALWAYS use this skill when the user mentions:**
- WebSocket connections in a Tauri app
- Real-time messaging or live updates
- WebSocket connect/disconnect lifecycle

**Trigger phrases include:**
- "websocket", "realtime", "live updates", "ws connection", "socket"

## How to use this skill

1. **Install the websocket plugin**:
   ```bash
   cargo add tauri-plugin-websocket
   ```
2. **Register the plugin** in your Tauri builder:
   ```rust
   tauri::Builder::default()
       .plugin(tauri_plugin_websocket::init())
   ```
3. **Configure capabilities** with allowed hosts in `src-tauri/capabilities/default.json`:
   ```json
   { "permissions": ["websocket:default"] }
   ```
4. **Connect and send messages from the frontend**:
   ```typescript
   import WebSocket from '@tauri-apps/plugin-websocket';
   const ws = await WebSocket.connect('wss://api.example.com/ws');
   ws.addListener((msg) => {
     console.log('Received:', msg.data);
   });
   await ws.send('Hello server!');
   await ws.disconnect();
   ```
5. **Implement reconnection logic** to handle network interruptions gracefully
6. **Restrict allowed hosts** in capabilities to prevent connections to unauthorized servers

## Outputs

- WebSocket plugin setup with connection lifecycle
- Message send/receive pattern with listeners
- Reconnection and error handling strategy

## References

- https://v2.tauri.app/plugin/websocket/

## Keywords

tauri websocket, realtime, live updates, WebSocket connection, socket