client-ketchup
Advanced tools
Comparing version
{ | ||
"name": "client-ketchup", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A simple interface for keeping remote clients up to date with their authoritative state", | ||
@@ -5,0 +5,0 @@ "main": "src/client-state-update.js", |
@@ -45,3 +45,3 @@ client-ketchup [](http://badge.fury.io/js/client-ketchup) [](https://travis-ci.org/chinedufn/client-ketchup) | ||
// Use whatever network protocol you please in order to send updates | ||
myClients['some-client-id-1'].websocket.send(minimalPatches) | ||
myClients['some-client-id-1'].websocket.send(JSON.stringify(minimalPatches)) | ||
@@ -87,3 +87,3 @@ /* | ||
Overwrite the clients state and receive JSON string-ified patches to send to a client | ||
Overwrite the clients state and receive JSON patches to send to a client | ||
@@ -90,0 +90,0 @@ Applying these patches to the old state creates the new state |
@@ -31,5 +31,4 @@ var objectDiff = require('minimal-object-diff') | ||
// We expect patches to be sent over a network so we string-ify them. | ||
return JSON.stringify(patches) | ||
return patches | ||
} | ||
} |
@@ -9,5 +9,5 @@ var test = require('tape') | ||
var patches = JSON.parse(CSU.update('key', { value: false })) | ||
var patches = CSU.update('key', { value: false }) | ||
t.deepEqual(patches, {x: {value: false}, d: ['value2']}) | ||
}) |
5759
-1.69%34
-2.86%