More Premium Hugo Themes Premium Nuxt Themes

Nuxt Websocket

A tiny Nuxt.js module for WebSocket interactions

Nuxt Websocket

A tiny Nuxt.js module for WebSocket interactions

Author Avatar Theme by deepsourcecorp
Github Stars Github Stars: 26
Last Commit Last Commit: Feb 5, 2025 -
First Commit Created: Dec 18, 2023 -
Nuxt Websocket screenshot

Overview:

The DeepSource module is a websocket dependency for Nuxt v2. It allows for WebSocket connections and provides a Vue instance and WebSocketManager instance for easy handling of events and data transmission.

Features:

  • WebSocket connection: Establish a WebSocket connection using the provided URL.
  • Reconnection: Automatically attempts reconnection for a close event that is not normal.
  • Runtime Config: Provide the WebSocket URL via runtime config, which takes precedence over options.
  • Vue instance and WebSocketManager instance: Accessible across the app, allows for easy handling of events and data transmission.

Installation:

To install the DeepSource module, follow these steps:

  1. Add the @deepsource/nuxt-websocket dependency to your project.

    npm install @deepsource/nuxt-websocket
    
  2. Add @deepsource/nuxt-websocket to the modules section of your nuxt.config.js file.

    modules: [
      '@deepsource/nuxt-websocket',
    ]
    
  3. If using TypeScript, add the types to your types array in the tsconfig.json file after the @nuxt/types entry (Nuxt 2.9.0+).

    {
      "compilerOptions": {
        "types": [
          "@nuxt/types",
          "@deepsource/nuxt-websocket"
        ]
      }
    }
    

Summary:

The DeepSource module for Nuxt v2 provides easy handling of WebSocket connections and data transmission. It allows for automatic reconnection, runtime config, and provides a Vue instance and WebSocketManager instance for seamless integration with your application. Follow the installation guide to start using DeepSource in your Nuxt project.