converse.js

repository·master·Indexed 25 days ago

https://github.com/conversejs/converse.js

A modern, feature-rich, 100% client-side XMPP chat application that runs in a web browser. It supports rich messaging, OMEMO end-to-end encryption, and file sharing via HTTP File Upload. Converse.js can be deployed as a standalone web app or integrated into websites using Fullpage, Overlay, or Embedded display modes. It includes a plugin architecture based on pluggable.js and provides a headless build (@converse/headless) for developers wishing to build custom user interfaces on top of the Converse XMPP engine.

Tokens
44.7K
Snippets
100
Records
325
Agent score
84%

What's inside converse.js

  1. Overview of converse-omemo plugin

    master

    The converse-omemo plugin provides an implementation of XEP-0384 OMEMO end-to-end encryption (version 0.3.0) for use with Converse.js.

    Important Note: This package only implements the headless (non-UI) logic. To use OMEMO with a user interface, you must also include the converse-omemo-views plugin to handle the UI components.

  2. Overview of Converse.js Display Modes

    master

    Converse.js can be integrated into websites using three distinct display modes depending on your UI requirements:

    • Fullpage: The default mode where Converse functions as a single-page application (SPA) covering the entire browser viewport.
    • Overlay: The chat interface appears as an overlay/chat box on top of your existing website content.
    • Embedded: The chat interface is integrated directly into specific elements within your page's DOM.
  3. Converse.js Key Features

    master

    Converse.js is a 100% client-side XMPP chat application with the following capabilities:

    • Rich Messaging: Supports message styling, corrections, reactions, and URL previews.
    • Privacy: End-to-end encryption via OMEMO.
    • File Sharing: Supports HTTP File Upload.
    • Notifications: Desktop notifications for incoming messages.
    • Extensibility: Uses a plugin architecture based on pluggable.js.
    • User Features: Custom status messages, availability indicators, and anonymous login (if supported by the server).
    • Internationalization: Supports over 40 languages.
    • Responsiveness: Optimized for both desktop and mobile devices.
  4. Quickstart: Use Converse via CDN

    master

    The fastest way to add Converse to your project is by including the CSS and JavaScript files from the official CDN in your HTML <head>. You can use the latest version or pin to a specific version like 14.0.0 for stability.

    <!-- Latest version -->
    <link rel="stylesheet" href="https://cdn.conversejs.org/dist/converse.min.css">
    <script type="module" src="https://cdn.conversejs.org/dist/converse.min.js"></script>
    
    <!-- Pin to specific version -->
    <link rel="stylesheet" href="https://cdn.conversejs.org/14.0.0/dist/converse.min.css">
    <script type="module" src="https://cdn.conversejs.org/14.0.0/dist/converse.min.js"></script>
  5. Set up a Converse development environment

    master

    To begin developing or customizing Converse, clone the repository and install dependencies using NPM. It is recommended to use NVM to manage Node.js versions.

    After cloning, run the following commands to start the development environment:

    1. Install dependencies: npm install
    2. Start the server in the background: npm run serve & (or make serve_bg)
    3. Start the watcher: npm run watch (or make watch)

    Once running, access the development interface at http://localhost:8000/dev.html.

    git clone https://github.com/conversejs/converse.js.git
    cd converse.js
    npm install
    npm run serve &
    npm run watch
  6. Initialize Converse in a Web Component Shadow DOM

    master

    When using Converse inside a web component's shadow DOM, you must set the root configuration option to the shadow-root of that DOM to ensure correct rendering.

    class CustomChatComponent extends HTMLElement {
        constructor() {
            super();
            const shadowRoot = this.attachShadow({ mode: 'open' });
            this.initConverse(shadowRoot);
        }
    
    initConverse(shadowRoot) {
        window.addEventListener('converse-loaded', function (event) {
            const { converse } = event.detail;
            converse.initialize({
                root: shadowRoot,
                // Other settings go here...
            });
        });
    }
    }
  7. Use Converse integration and display modes

    master

    Converse can be integrated into your web application in three ways:

    1. Standalone page: Run Converse as its own dedicated page.
    2. Floating overlay: Run Converse as a floating UI element over your existing content.
    3. Embedded mode: Embed the chat interface directly inside a specific <div> on your page.

    You can also trigger specific chat views using URL fragments, such as #converse/chat?jid=user@domain to open a direct chat with a specific JID.