Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/optimalbits/wing
Realtime model synchronization
https://github.com/optimalbits/wing
Last synced: 6 days ago
JSON representation
Realtime model synchronization
- Host: GitHub
- URL: https://github.com/optimalbits/wing
- Owner: OptimalBits
- Created: 2014-01-08T13:34:52.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-02-10T09:37:41.000Z (almost 5 years ago)
- Last Synced: 2024-08-09T13:26:56.475Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Wing
====Socket.io with wings.
Provides the observe pattern for distributed clients and services.
Wraps socket.io and redis pub/sub for super easy usage with built
in authentication, session support and middleware for express
and angular directives.Best way to explain its use is with an example:
```javascript
//
// Client
// Observe document 1234 on collection medias.
wing.observe('/medias/1234').on('change', function(keypath, doc))
}).on('error', function(err){
console.log(err);
})//
// update will trigger all observers but the one updating.
//
wing.update('/medias/1234', {name: "my super name"});wing.unobserve('/medias/1234');
//
// Server
//
var wing = Wing(socketIo, redisOpts);//
// Make a keypath observable (needed?, maybe for having rights on it.)
//
wing.observable('/medias/:id', function(session, keyPath){
// This callback is called when a client request to observe the given resource.
return true;
});wing.observable('/campaigns/:id');
wing.observable('/funds/:id');//
// update will trigger all observers but the one updating.
//
wing.update('/medias/1234', {progress: 30});//
// API.
//
wing.uuid(); // Generates a global unique uuid that can be used by clients or servers.
```