惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Announcements
Recent Announcements
L
Lohrmann on Cybersecurity
Vercel News
Vercel News
P
Palo Alto Networks Blog
P
Proofpoint News Feed
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
L
LangChain Blog
Y
Y Combinator Blog
T
Tenable Blog
腾讯CDC
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU
A
Arctic Wolf
Security Latest
Security Latest
IT之家
IT之家
Latest news
Latest news
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
T
Tor Project blog
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AWS News Blog
AWS News Blog
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
量子位
T
Troy Hunt's Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
I
InfoQ
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
Intezer
爱范儿
爱范儿
C
Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support
Real-time updates using WebSockets
Gerson Leiva · 2025-10-06 · via Inside Nutrient

Table of contents

    Real-time updates using WebSockets

    TL;DR

    WebSockets:

    • Provide persistent connections for real-time communication
    • Replace HTTP polling with instant, low-overhead updates
    • Are perfect for notification systems and collaborative features
    • Are easy to implement with Socket.io in Node.js applications

    In a large, data-intensive application like Nutrient Workflow, HTTP requests are everywhere. They’re how the frontend communicates with the backend, and they’re integral to core functionality.

    Over time, though, it can feel like every new piece of frontend functionality requires yet another request. But constant polling and one-off requests aren’t always the most efficient approach. Sometimes, there’s a better fit: WebSockets.

    WebSockets are a protocol that enable real-time communication between a client and a server. The key difference between WebSockets and traditional HTTP requests is persistence: With HTTP, each request creates a new connection, while WebSockets maintain a single, open connection after the initial handshake. This persistent connection is what makes WebSockets ideal for low-latency, low-overhead communication.

    Automate tasks and collaborate in real time.

    The problem with HTTP polling

    Recently, we had a use case for WebSockets in Nutrient Workflow. It’s admittedly a small feature, but it lays the groundwork for powerful future capabilities, like real-time collaboration in the app.

    Currently, Workflow admins have a notification icon in the top navigation bar showing the number of unread messages. These messages contain important information about the system, so it’s crucial that admins see new ones as soon as possible.

    Originally, we were checking for new messages by making periodic HTTP requests, but it wasn’t the best solution. It wasn’t in real time, and it added even more noise to an already chatty, data-heavy app.

    The original approach: Periodic HTTP requests to check for new notifications every few seconds, creating unnecessary server load and delayed updates.

    It quickly became clear that WebSockets were the better approach. When using them, admins get new messages instantly, and we eliminate the overhead of constant polling.

    WebSocket advantages

    Real-time updates

    • Instant communication with no polling delays

    Lower overhead

    • Single persistent connection vs. repeated HTTP requests

    Reduced server load

    • No unnecessary requests checking for updates

    Better user experience

    • Immediate feedback and notifications

    Implementation with Socket.io

    To implement the solution, we installed the socket.io package(opens in a new tab):

    From there, setup was simple. On the server, we connect using a helper function:

    let io;

    function init(server, service) {

    try {

    io = require("socket.io")(server, {

    serveClient: false,

    path: `/api/${service}/socket.io`,

    cors: {

    origin: "*",

    methods: ["GET", "POST"],

    },

    transports: ["websocket"],

    });

    io.on("connection", (socket) => {

    console.log("[WebSocket] Client connected! Socket ID:", socket.id);

    socket.on("disconnect", (reason) => {

    console.log(

    `[WebSocket] Client disconnected. Socket ID: ${socket.id}, Reason: ${reason}`,

    );

    });

    });

    } catch (error) {

    console.error("[WebSocket] Error initializing WebSocket server:", error);

    }

    }

    function broadcast(event, data) {

    if (!io) {

    console.log("[WebSocket] No WebSocket server initialized!");

    return;

    }

    console.log("[WebSocket] Broadcasting event:", event, "Data:", data);

    io.emit(event, data);

    }

    module.exports = {

    init,

    broadcast,

    };

    We then use this in our services, like so:

    let server = await app.listen(port);

    websocket.init(server, "settings");

    When a notification gets published server side, we can broadcast the message to the connected client:

    websocket.broadcast("newNotification", message);

    Client-side implementation

    On the client side, we have a helper function for managing sockets:

    import { io } from "socket.io-client";

    let sockets = new Map();

    export function getSocket(service) {

    if (!sockets.hasOwnProperty(service)) {

    sockets.set(

    service,

    io(location.host, {

    transports: ["websocket"],

    upgrade: false,

    path: `/api/${service}/socket.io`,

    }),

    );

    sockets.get(service).on("connect", () => {

    console.log(

    `[WebSocket: ${service}] Connected successfully! Socket ID: ${sockets.get(service).id}`,

    );

    });

    }

    return sockets.get(service);

    }

    And we use it like this:

    this.settingsSocket = socket.getSocket("settings");

    this.settingsSocket.on("newNotification", (event) => {

    // Handle new notification here.

    updateNotificationCount(event.count);

    showNotificationToast(event.message);

    });

    Pro tip: Use Map to manage multiple socket connections for different services, ensuring each service maintains its own connection lifecycle.

    Building a proof of concept

    Want to try it yourself? What follows is a simple proof of concept (POC) you can run locally using Node.js and plain HTML.

    Step 1 — Set up a basic WebSocket server

    Install the dependencies:

    npm init -y

    npm install express socket.io

    Create a file called server.js:

    const express = require("express");

    const http = require("http");

    const socketIo = require("socket.io");

    const app = express();

    const server = http.createServer(app);

    const io = socketIo(server);

    app.use(express.static(__dirname + "/public"));

    io.on("connection", (socket) => {

    console.log("🔌 New client connected:", socket.id);

    socket.emit("message", "👋 Hello from the server!");

    socket.on("ping", () => {

    console.log("📡 Received ping from client");

    socket.emit("message", "🏓 Pong!");

    });

    socket.on("disconnect", () => {

    console.log("❌ Client disconnected:", socket.id);

    });

    });

    server.listen(3000, () => {

    console.log("🚀 Server listening on http://localhost:3000");

    });

    Step 2 — Add a simple frontend

    Create a public folder, and inside it, add index.html:

    <!DOCTYPE html>

    <html lang="en">

    <head>

    <meta charset="UTF-8" />

    <title>WebSocket Demo</title>

    <style>

    body {

    font-family: Arial, sans-serif;

    max-width: 600px;

    margin: 50px auto;

    padding: 20px;

    }

    button {

    background: #007bff;

    color: white;

    border: none;

    padding: 10px 20px;

    border-radius: 4px;

    cursor: pointer;

    margin: 10px 0;

    }

    button:hover {

    background: #0056b3;

    }

    #messages {

    border: 1px solid #ddd;

    height: 300px;

    overflow-y: auto;

    padding: 10px;

    margin: 20px 0;

    }

    .message {

    padding: 5px 0;

    border-bottom: 1px solid #eee;

    }

    </style>

    </head>

    <body>

    <h1>WebSocket Demo</h1>

    <button id="ping">Send Ping</button>

    <div id="messages"></div>

    <script src="/socket.io/socket.io.js"></script>

    <script>

    const socket = io();

    const messages = document.getElementById("messages");

    const button = document.getElementById("ping");

    socket.on("connect", () => {

    console.log("Connected to WebSocket server!");

    addMessage("✅ Connected to server");

    });

    socket.on("message", (msg) => {

    addMessage(`📢 ${msg}`);

    });

    socket.on("disconnect", () => {

    addMessage("❌ Disconnected from server");

    });

    button.addEventListener("click", () => {

    socket.emit("ping");

    addMessage("📤 Sent ping to server");

    });

    function addMessage(text) {

    const div = document.createElement("div");

    div.className = "message";

    div.textContent = `${new Date().toLocaleTimeString()} - ${text}`;

    messages.appendChild(div);

    messages.scrollTop = messages.scrollHeight;

    }

    </script>

    </body>

    </html>

    Step 3 — Run it

    Open your browser and go to http://localhost:3000. You’ll see a message from the server, and when you click the Send Ping button, you’ll get a “Pong!” back instantly.

    Best practices and considerations

    When implementing WebSockets in production applications, consider these important practices:

    Implement proper connection handling with reconnection logic for network interruptions. Use exponential backoff to prevent overwhelming the server during reconnection attempts.

    const socket = io(serverUrl, {

    reconnection: true,

    reconnectionDelay: 1000,

    reconnectionAttempts: 5,

    maxReconnectionAttempts: 5,

    });

    Always implement comprehensive error handling for both client and server sides. WebSocket connections can fail for various reasons, including network issues, server restarts, and client-side problems.

    socket.on("connect_error", (error) => {

    console.error("Connection failed:", error);

    // Implement fallback strategy.

    });

    Implement proper authentication for WebSocket connections. Unlike HTTP requests, WebSocket connections maintain state, so ensure you validate users appropriately.

    io.use((socket, next) => {

    const token = socket.handshake.auth.token;

    if (isValidToken(token)) {

    next();

    } else {

    next(new Error("Authentication error"));

    }

    });

    For applications with many concurrent connections, consider using Socket.io with Redis adapter for horizontal scaling across multiple server instances.

    const { createAdapter } = require("@socket.io/redis-adapter");

    const { createClient } = require("redis");

    const pubClient = createClient({ host: "localhost", port: 6379 });

    const subClient = pubClient.duplicate();

    io.adapter(createAdapter(pubClient, subClient));

    Future possibilities

    We’ve barely scratched the surface of what WebSockets can do, but even this small addition opens the door to exciting possibilities for Nutrient Workflow:

    • Real-time collaboration — Multiple users editing documents simultaneously with live updates
    • Live status indicators — Show which team members are currently active in workflows
    • Instant form submissions — Real-time validation and submission feedback
    • Live analytics — Dashboard updates showing workflow metrics as they happen
    • Chat integration — Built-in messaging for workflow collaboration
    • Progress tracking — Real-time updates on long-running workflow processes

    The notification system we implemented was just the beginning. As we continue to explore WebSockets in Nutrient Workflow, we’re excited about the enhanced user experiences and collaborative features they’ll enable.

    Conclusion

    WebSockets transform the way applications handle real-time communication. By replacing HTTP polling with persistent connections, they provide instant updates with minimal overhead — perfect for modern, data-intensive applications like Nutrient Workflow.

    The implementation is straightforward with libraries like Socket.io, and the benefits are immediate: better user experience, reduced server load, and the foundation for advanced real-time features.

    Whether you’re building notification systems, collaborative tools, or live dashboards, WebSockets offer a robust solution for real-time communication that scales with your application’s needs. By leveraging WebSockets, applications can move beyond repetitive HTTP requests to deliver real-time updates, reduce server load, and provide a more responsive, engaging experience — laying the foundation for advanced features and seamless user interactions.

    Streamline your business with real-time automation and collaboration.

    Explore related topics

    Try for free Ready to get started?

    Related Workflow articles

    Explore more