
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
feathers-sync
Advanced tools
Synchronize service events between application instances using Redis or MongoDB publish/subscribe
When running multiple instances of your Feathers application (e.g. on several Heroku Dynos), service events (created
, updated
, patched
, removed
) do not get propagated to other instances. feathers-sync uses MongoDB publish/subscribe via mubsub or Redis via redis to propagate all events to all application instances.
This allows to scale real-time websocket connections to any number of clients.
The application initialized in the following example will use the local feathers-sync
database and sync
collection and share service events with every other instance connected to the same database:
var feathers = require('feathers');
var sync = require('feathers-sync');
var app = feathers();
app.configure(feathers.rest())
.configure(feathers.socketio())
.configure(sync({
db: 'mongodb://localhost:27017/sync',
collection: 'events'
}))
.use('/todos', todoService);
app.listen(3000);
mongodb://localhost:27017/events
) or database objectevents
){authSource:'admin'}
)Additionally you can pass the original sync options:
true
)redis://localhost:6379
) or database objectamqp://guest:guest@localhost:5672
)When listening to service events with this, all events are going to get propagated to all clients. This means, that your event listeners should not perform any actions that change the global state (e.g. write something into the database) because every client will perform the same action.
Instead, event listeners should only be used to update the local state (e.g. a local cache) and send real-time updates to all connected clients, e.g. all browsers listening to websocket events.
If you need to perform actions, for example setting up a first blog post after a new user has been created add it to the service method itself (which will only run on its own instance) or use feather-hooks after hooks.
0.1.0
Copyright (c) 2015 David Luecke
Licensed under the MIT license.
v0.1.4 (2017-11-11)
Closed issues:
patch
or put
requests #63Merged pull requests:
FAQs
Feathers
The npm package feathers-sync receives a total of 2,029 weekly downloads. As such, feathers-sync popularity was classified as popular.
We found that feathers-sync demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.