Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
client-ketchup
Advanced tools
A simple interface for keeping remote clients up to date with their authoritative state
A simple interface for keeping remote clients up to date with their authoritative state
The goal of client-ketchup
is to be a small API for managing the states of a constantly changing set of connected clients.
A server might have an enormous application state object but each client only needs to know about different pieces of this data.
When a specific client's state changes, we generate a small set of string-ified patches to send to them so that they can update (or catch-up) their local state.
This helps avoid sending a massive amount of data over whenever we have new state information to each connected client.
The intended use case was for running multiplayer game servers, but an example potential different case might be a websocket powered real-time database.
$ npm install --save client-ketchup
/*
* On our server
*/
// Use this to generate new client state trackers
var CreateClientStateTracker = require('client-ketchup')
// Create a new client state tracker. You'll typically use one of these and add/remove different clients to it
var CST = CreateClientStateTracker()
// Add a new client
CST.add('some-client-id-1')
// Update our clients view of the world and then receive a set of JSON stringified patches that we can send over
var minimalPatches = CST.update({foo: 'bar', bazz: 'buzz'})
// Use whatever network protocol you please in order to send updates
myClients['some-client-id-1'].websocket.send(minimalPatches)
/*
* Later on our client
*/
var patchObject = require('minimal-object-diff').patch
var minimalPatches = GetPatchesFromServerSomehow()
var myLocalState = GetLocalState()
myLocalState = patchObject(myLocalState, JSON.parse(minimalPatches))
client-ketchup
only concerns itself with helping to keep track of and generate optimized diffs for your client data.
The method of transport
(websocket, server-sent events, carrier pidgen, etc)
is up to the consumer.
Typically you'll already have your network protocol in place and client-ketchup
will be sprinkled in order to reduce bandwidth.
# view the demo in a local browser by pasting this into your terminal:
# changes to the `demo` directory will live reload in your browser
git clone https://github.com/chinedufn/client-ketchup && cd client-ketchup && npm install && npm run demo
MIT
FAQs
A simple interface for keeping remote clients up to date with their authoritative state
We found that client-ketchup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.