A Knockout plugin that syncs observable variables between all clients automatically
JavaScript HTML CSS
Latest commit 67a7550 Dec 3, 2015 @thelinuxlich Merge pull request #2 from cdolek/master
latest knockout / jquery and some structuring
Failed to load latest commit information.
css move css to seperate file Nov 6, 2015
js upgrade to knockout v3.4.0 Dec 2, 2015
.gitignore gitignore Nov 4, 2015
MIT-LICENSE.txt Adding the MIT License Feb 1, 2011
README.md readme updated Dec 2, 2015
index.html upgrade to knockout v3.4.0 Dec 2, 2015
package.json package.json Nov 4, 2015
server.js line edit Dec 2, 2015

README.md

Knockout Live Plugin

Installation:

Clone the repository

npm install
node server.js

Visit /index.html to see the example chat application.

Files:

  • js/knockout.live.plugin.js on the client
  • js/main.js has the example for the chat application
  • server.js running on node server

Dependencies:

  • Knockout 3.4.0
  • Socket.io v1.3.7 client/server
  • Node.js and socket.io on the server side
  • index.html should be requested from a web server e.g. apache, nginx

Notes

  • The chat example runs on port 4000, change port variable in js/main.js and server.js if required
  • Check the terminal for logs (message sent & disconnected client)

What do you need for your application to go "live"?:

  • Set .live() on all ko.observable() and ko.observableArray() you want to synchronize remotely(see the chat example)
  • Run ko.utils.socketConnect(address,port) before ko.applyBindings()

Options for live():

  • id: "my_id" sets a custom ID for sync purposes. This is useful if you are syncing between different apps.
  • readonly: true blocks all direct changes to the live observable. It will update only by socket messages from the server.

TODO:

  • Adapter interface for sync options besides socket.io