Live()

When you initialize the client with { io: false }, it disables Socket.IO, meaning the client won't receive real-time events from the server. However, internal events within the client still function, allowing you to listen for and handle them without relying on WebSocket communication.

import Client from "noonjs-client";
const client = new Client("http://localhost:3000", { io: false }); // client without socket.io
const todo = await client.collection("todos").post({
    "title": "New Task",
    "priority": "high"
}); // no server events will be received, just local events

you can use the live() method, which re-enables Socket.IO and allows the client to receive real-time events from the server.

await client.live(); // re-enable socket.io

Usage

If you have an app and want to avoid connecting all visitors—especially those on the main page—to Socket.IO to reduce server load, you can set { io: false } when creating the client. Then, when the user navigates to the dashboard, you can use the live() method to establish a Socket.IO connection and receive live events.

Edit this page on Github
© 2025 kav3.com. Crafted with and dedication.