{"id":18373997,"url":"https://github.com/enigmacurry/cycle-deepstream","last_synced_at":"2025-04-06T19:32:29.869Z","repository":{"id":66637883,"uuid":"83736303","full_name":"EnigmaCurry/cycle-deepstream","owner":"EnigmaCurry","description":"Cycle.js driver for deepstream.io","archived":false,"fork":false,"pushed_at":"2018-06-18T19:11:12.000Z","size":2511,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T06:12:33.946Z","etag":null,"topics":["cyclejs","deepstream"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EnigmaCurry.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-02T23:43:36.000Z","updated_at":"2018-06-18T19:11:14.000Z","dependencies_parsed_at":"2024-01-02T23:19:08.456Z","dependency_job_id":"a4012292-a664-4104-bc05-e1afadd109d9","html_url":"https://github.com/EnigmaCurry/cycle-deepstream","commit_stats":{"total_commits":145,"total_committers":3,"mean_commits":"48.333333333333336","dds":"0.020689655172413834","last_synced_commit":"86a1fab4e0e79333b7d4e670c94fc519449a7746"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnigmaCurry%2Fcycle-deepstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnigmaCurry%2Fcycle-deepstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnigmaCurry%2Fcycle-deepstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnigmaCurry%2Fcycle-deepstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EnigmaCurry","download_url":"https://codeload.github.com/EnigmaCurry/cycle-deepstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247539392,"owners_count":20955303,"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":["cyclejs","deepstream"],"created_at":"2024-11-06T00:13:01.664Z","updated_at":"2025-04-06T19:32:27.410Z","avatar_url":"https://github.com/EnigmaCurry.png","language":"TypeScript","readme":"cycle-deepstream\n=====================\n\n[![Build Status](https://travis-ci.org/EnigmaCurry/cycle-deepstream.svg?branch=master)](https://travis-ci.org/EnigmaCurry/cycle-deepstream)\n[![npm version](https://img.shields.io/npm/v/cycle-deepstream.svg?maxAge=86400)](https://www.npmjs.com/package/cycle-deepstream)\n[![Coverage Status](https://coveralls.io/repos/github/EnigmaCurry/cycle-deepstream/badge.svg?branch=master)](https://coveralls.io/github/EnigmaCurry/cycle-deepstream?branch=master)\n[![Join the chat at https://gitter.im/EnigmaCurry/cycle-deepstream](https://badges.gitter.im/EnigmaCurry/cycle-deepstream.svg)](https://gitter.im/EnigmaCurry/cycle-deepstream?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nA [Cycle.js](https://cycle.js.org/) driver for the [deepstream.io](https://deepstream.io) javascript client.\n\nAllows realtime communication between multiple clients and your cluster of deepstream servers. A self-hosted firebase replacement.\n\n![simple example](https://cloud.githubusercontent.com/assets/43061/23532850/f8351d38-ff7b-11e6-9645-905309d7ee05.gif)\n![advanced example](https://cloud.githubusercontent.com/assets/43061/25155996/0e173f0a-2466-11e7-8b5f-e7945295b61f.gif)\n\n*(above: the simple example running in three browser windows, and the advanced example simulating two mobile devices.)*\n\nRun Demo\n----------\nGet the code:\n\n    git clone https://github.com/EnigmaCurry/cycle-deepstream.git\n    cd cycle-deepstream\n    npm install\n    \nRun the simple example:\n\n    npm run simple\n\nOr run the advanced demo:\n\n    npm run advanced\n\nUsage Notes\n-------------\n\nNo formal docs exist for this yet. This driver implements most of the [deepstream API methods](https://deepstream.io/docs/client-js/client/). In Cycle.js you never use imperative calls directly (code with side-effects), so cycle-deepstream wraps these calls into a driver with an API that uses [plain-javascript objects to define actions (actions.ts)](https://github.com/EnigmaCurry/cycle-deepstream/blob/master/src/actions.ts).\n\nFor instance, calling record.subscribe returns an object that just describes what action to perform:\n\n    \u003e const {actions} = require('cycle-deepstream')\n    \u003e actions.record.subscribe('some-record')\n    { action: 'record.subscribe',\n      name: 'some-record',\n      events: {},\n      scope: undefined }\n\nThis action describes the appropriate deepstream API method to call and some additional arguments. In this case they are:\n\n * action - the deepstream API method name\n * name - the name of the deepstream record to subscribe to\n * events - the names of the [record events](https://deepstream.io/docs/client-js/datasync-record/#events) that we wish to subscribe to. The default is to subscribe to all of them, eg: ```{'record.existing': true, 'record.change': true, 'record.discard': true, 'record.delete': true, 'record.error': true }```. \n * scope - this is a common argument to all of the methods, it specifies a particular ID to the request that is also applied to the response. This allows your code to know whether a particular event is due to your actions by filtering the event stream on this same ID. If no scope is defined, a default scope is used that is shared amongst all other requests that also don't use a scope. This mostly affects record.discard, as this will only discard the subscription of the record with the same scope defined.\n\nThis plain object is sent to the driver in it's input stream and processed by the driver asynchronously. When a deepstream event comes from the server, the driver passes this information to the output stream and back into your cycle application. Events of this sort look like this:\n\n    { event: 'record.change',\n      name: 'some-record',\n      data: {\n        foo: 'bar'\n      },\n      scope: undefined }\n\nThis event is the first response to our subscribe action above, consisting of the data of the existing content of the 'some-record' object in deepstream's database. Subseqent events would be more 'record.change' events or possibly 'record.delete' etc.\n\nThere's a helper function to apply scopes to actions:\n\n    \u003e const {actions} = require('cycle-deepstream')\n    \u003e const scope = actions.scope()    /* This returns a function, a 'scope applier' */\n    \u003e scope(actions.record.get('some-record'))\n    { action: 'record.get',\n      name: 'some-record',\n      scope: 'j1jlj39z5ue7chjjdi4g' }    /* A randomly generated scope ID */\n    \u003e scope.scope   /* The scope ID is available on the object, even though it's a function */\n    'j1jlj39z5ue7chjjdi4g'\n\n\nThe events you receive for the record will now have the scope `j1jlj39z5ue7chjjdi4g` applied to them so that you can filter on it in your own code.\n\nThere are [two examples](https://github.com/EnigmaCurry/cycle-deepstream/tree/master/examples) that show general usage. The [end-to-end test](https://github.com/EnigmaCurry/cycle-deepstream/blob/master/src/index.spec.ts) show comprehensive usage. \n\nFeatures\n----------\n\nDeepstream API Implementation:\n  - Client\n    - [x] login\n    - [x] logout\n    - events:\n      - [x] onConnectionChange\n      - [x] client.error\n      - [x] login.success\n      - [x] login.failure\n      - [x] logout\n  - Records:\n    - [x] record.subscribe\n       - once subscribed, will emit events:\n         - [x] record.change\n         - [x] record.discard\n         - [x] record.delete\n         - [x] record.error\n    - [x] record.set\n    - [x] record.get\n    - [x] record.snapshot\n    - [x] record.discard\n    - [x] record.delete\n    - [x] record.listen\n    - [ ] record.unsubscribe\n      - Not implemented. Use record.discard instead.\n    \n  - Lists:\n    - [x] list.subscribe\n      - once subscribed, will emit events:\n         - [x] list.change\n         - [x] list.entry-existing\n           - This emits individual events, like list.entry-added, but for each existing entry in the list.\n           - Note, this is a driver level event, not a part of the Deepstream API.\n         - [x] list.discard\n         - [x] list.delete\n         - [x] list.error\n         - [x] list.entry-added\n         - [x] list.entry-moved\n         - [x] list.entry-removed\n    - [x] list.getEntries\n    - [x] list.setEntries\n    - [x] list.addEntry\n    - [x] list.removeEntry\n    - [x] list.discard\n    - [x] list.delete\n    - [ ] list.unsubscribe\n      - Not implemented. Use list.discard instead.\n    \n    \n  - Events:\n    - [x] event.subscribe\n    - [x] event.unsubscribe\n    - [x] event.emit\n    - [x] event.listen\n    - [x] event.unlisten\n    \n  - Presence:\n    - [x] presence.subscribe\n    - [x] presence.unsubscribe\n    - [x] presence.getAll\n    \n  - RPC:\n    - [x] rpc.make\n    - [ ] rpc.provide - I think this makes no sense to implement in cycle?\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenigmacurry%2Fcycle-deepstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenigmacurry%2Fcycle-deepstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenigmacurry%2Fcycle-deepstream/lists"}