tauri-app-websocket

Installation
SKILL.md

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:
    cargo add tauri-plugin-websocket
    
  2. Register the plugin in your Tauri builder:
    tauri::Builder::default()
        .plugin(tauri_plugin_websocket::init())
    
  3. Configure capabilities with allowed hosts in src-tauri/capabilities/default.json:
    { "permissions": ["websocket:default"] }
    
  4. Connect and send messages from the frontend:
    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

Keywords

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

Related skills

More from partme-ai/full-stack-skills

Installs
6
GitHub Stars
366
First Seen
Mar 25, 2026