{"id":14954677,"url":"https://github.com/meteor/redis-livedata","last_synced_at":"2025-10-19T22:30:15.148Z","repository":{"id":18159641,"uuid":"21257704","full_name":"meteor/redis-livedata","owner":"meteor","description":"Realtime data-sync support for Redis in Meteor","archived":false,"fork":false,"pushed_at":"2015-12-12T00:58:52.000Z","size":677,"stargazers_count":147,"open_issues_count":15,"forks_count":17,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-01-28T23:44:15.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://atmospherejs.com/package/redis-livedata","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meteor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-26T23:07:05.000Z","updated_at":"2023-01-14T05:43:51.000Z","dependencies_parsed_at":"2022-08-28T05:21:30.366Z","dependency_job_id":null,"html_url":"https://github.com/meteor/redis-livedata","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor%2Fredis-livedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor%2Fredis-livedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor%2Fredis-livedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor%2Fredis-livedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meteor","download_url":"https://codeload.github.com/meteor/redis-livedata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237221176,"owners_count":19274447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:04:48.035Z","updated_at":"2025-10-19T22:30:14.537Z","avatar_url":"https://github.com/meteor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redis Livedata\n\n`redis-livedata` is a Meteor unipackage available on\n[Atmosphere](https://atmospherejs.com/package/redis-livedata).\n\nThe goal of this package is to bring full-stack reactivity support for Redis\nin Meteor applications. This includes data-sync and latency-compensation, combined\nwith Meteor's plug'n'play packaging interface, ease of use and flexible\npermissions system.\n\n\n## Installation\n\nAdd this package to your Meteor app:\n\n    meteor add slava:redis-livedata\n\nSince Redis is not yet shipped with Meteor or this package, you need to\nhave a running Redis server and a url to connect to it. You can install Redis locally\non Mac OS X with homebrew `brew install redis` or by following the\n[instructions](http://redis.io/download) for other platforms. The latest tested\nand officially supported version of Redis is 2.8.9.\n\nTo configure the Redis server connection information, pass its url as the `REDIS_URL`\nenvironment variable to the Meteor server process. It defaults to `localhost:6379`.\n\n    env REDIS_URL=redis://username:password@1.2.3.4:6379 meteor\n\nTo provide reactivity, this package uses [Redis Keyspace Notifications](http://redis.io/topics/notifications).  You\nneed to enable keyspace notifications; you should do this either from redis-cli:\n\n    CONFIG SET notify-keyspace-events AKE\n\nor set the `REDIS_CONFIGURE_KEYSPACE_NOTIFICATIONS=1` environment variable for\nyour Meteor application server process, and the package will then configure this for you:\n\n    env REDIS_CONFIGURE_KEYSPACE_NOTIFICATIONS=1 REDIS_URL=... meteor\n\n## RedisCollection\n\nJust like Meteor.Collection with Mongo, you will work with Meteor.RedisCollection for\nRedis data.\n\nYou can instantiate a RedisCollection on both client and on the server.  The\ncollection can be either unnamed (unmanaged, just in-memory) or must be \"redis\"\nas Redis doesn't have any concept of namespaced collections.\n\n```javascript\nvar redisCollection = new Meteor.RedisCollection(\"redis\");\n```\n\nThe collection wraps the Redis commands.  If a callback is passed then the\ncommands execute asynchronously.  If no callback is passed, on the server,\nthe call is executed synchronously (technically this uses fibers and only\nappears to be synchronous, so it does not block the event-loop).  If\nyou're on the client and don't pass a callback, the call executes asynchronously\nand you won't be notified of the result.\n\n## Publish/Subscribe\n\nOne can publish a cursor just like in mongo-livedata.  The Redis equivalent of 'find' is 'matching', which\nmatches keys using [Redis pattern matching syntax](http://redis.io/commands/keys).\n\n```javascript\nMeteor.publish(\"peter-things\", function () {\n  return redisCollection.matching(\"peter-things-*\");\n});\n```\n\nThis way data will be automatically synchronized to all subscribed clients.\n\n## Latency compensation\n\nLatency compensation works with all supported commands used either at the\nclient or client's simulations.\n\n## Permissions: allow/deny\n\nBecause redis has so many commands, unlike mongo-livedata all commands go\nthrough one allow/deny callback method: `exec`.\n\n```javascript\n// allow only 'incr' calls on keys starting with 'peter-things-'\nredisCollection.allow({\n  exec: function (userId, command, args) {\n    if (command !== 'incr') return false;\n    if (_.any(args, function (key) { return key.substr(0, 13) !== \"peter-things-\"; }))\n      return false;\n    return true;\n  }\n});\n```\n\n## Supported commands\n\nRight now only commands related to keys and strings are supported (but not\nbinary operations) and Hashes. Sets, ordered sets and other are not currently\nsupported.\n\nFlushall does not currently work, because Redis doesn't send a keyspace notification.\n\n## Known Issues\n\nRight now it is known that the following things don't work:\n\n- publishing an array of cursors (create several separate publishes instead)\n- flushall is not noticed\n- no support for sets, ordered sets, lists, hyperloglog, etc\n\n# License\n\nMIT (c) Meteor Development Group\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeteor%2Fredis-livedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeteor%2Fredis-livedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeteor%2Fredis-livedata/lists"}