faye-redis-ng 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/RELEASE.md +117 -0
- package/.github/SETUP.md +251 -0
- package/.github/TRUSTED_PUBLISHING.md +219 -0
- package/.github/workflows/ci.yml +70 -0
- package/.github/workflows/publish.yml +77 -0
- package/AUTOMATION.md +256 -0
- package/CHANGELOG.md +98 -0
- package/CLAUDE.md +134 -0
- package/CODE_OF_CONDUCT.md +4 -0
- package/LICENSE +22 -0
- package/NPM_PUBLISH.md +358 -0
- package/README.md +215 -0
- package/REFACTORING.md +215 -0
- package/faye-redis.js +359 -0
- package/package.json +37 -0
package/NPM_PUBLISH.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# NPM Publishing Guide for faye-redis-ng
|
|
2
|
+
|
|
3
|
+
This guide will help you publish `faye-redis-ng` to npm.
|
|
4
|
+
|
|
5
|
+
## 🤖 Automated Publishing with Trusted Publishing (Recommended)
|
|
6
|
+
|
|
7
|
+
This project uses **GitHub Actions** with **Trusted Publishing (OIDC)** - the modern, secure way to publish to npm. No tokens needed!
|
|
8
|
+
|
|
9
|
+
### 🔒 Why Trusted Publishing?
|
|
10
|
+
|
|
11
|
+
**Traditional method** ❌:
|
|
12
|
+
- Create npm token
|
|
13
|
+
- Store in GitHub Secrets
|
|
14
|
+
- Risk of token leakage
|
|
15
|
+
- Manual token rotation
|
|
16
|
+
|
|
17
|
+
**Trusted Publishing** ✅:
|
|
18
|
+
- Zero tokens to manage
|
|
19
|
+
- GitHub authenticates directly with npm
|
|
20
|
+
- More secure (OIDC protocol)
|
|
21
|
+
- Recommended by npm
|
|
22
|
+
|
|
23
|
+
### Quick Start
|
|
24
|
+
|
|
25
|
+
**Step 1**: First manual publish (once)
|
|
26
|
+
```bash
|
|
27
|
+
npm login
|
|
28
|
+
npm publish --access public
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Step 2**: Configure on npm
|
|
32
|
+
1. Go to https://www.npmjs.com/package/faye-redis-ng/settings
|
|
33
|
+
2. Publishing access → Add trusted publisher
|
|
34
|
+
3. Provider: **GitHub Actions**
|
|
35
|
+
4. Repository: **YOUR-USERNAME/faye-redis-ng**
|
|
36
|
+
5. Workflow: **publish.yml**
|
|
37
|
+
|
|
38
|
+
**Step 3**: Push tags
|
|
39
|
+
```bash
|
|
40
|
+
git tag v1.0.1 && git push origin v1.0.1
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Done!** 🎉 Fully automated, zero secrets.
|
|
44
|
+
|
|
45
|
+
**See `.github/SETUP.md` for detailed setup instructions.**
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 📦 Manual Publishing (Alternative)
|
|
50
|
+
|
|
51
|
+
If you prefer manual control or need to publish without automation:
|
|
52
|
+
|
|
53
|
+
## Pre-Publishing Checklist
|
|
54
|
+
|
|
55
|
+
### 1. Verify Package Information
|
|
56
|
+
|
|
57
|
+
- ✅ Package name: `faye-redis-ng`
|
|
58
|
+
- ✅ Version: `1.0.0` (starting fresh for NG version)
|
|
59
|
+
- ✅ Description updated
|
|
60
|
+
- ✅ Keywords added for discoverability
|
|
61
|
+
- ✅ License: MIT (same as original)
|
|
62
|
+
- ✅ Repository URL (update when you create your fork)
|
|
63
|
+
|
|
64
|
+
### 2. Prepare Your Repository
|
|
65
|
+
|
|
66
|
+
**Important**: Update the repository URL in `package.json` to point to YOUR fork:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"repository": {
|
|
71
|
+
"type": "git",
|
|
72
|
+
"url": "https://github.com/YOUR-USERNAME/faye-redis-ng.git"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "https://github.com/YOUR-USERNAME/faye-redis-ng",
|
|
75
|
+
"bugs": "https://github.com/YOUR-USERNAME/faye-redis-ng/issues"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. Files to Include/Exclude
|
|
80
|
+
|
|
81
|
+
Create or update `.npmignore`:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
# Development files
|
|
85
|
+
spec/
|
|
86
|
+
vendor/
|
|
87
|
+
test-*.js
|
|
88
|
+
.git/
|
|
89
|
+
.gitmodules
|
|
90
|
+
*.rdb
|
|
91
|
+
|
|
92
|
+
# Documentation (keep these)
|
|
93
|
+
!README.md
|
|
94
|
+
!CLAUDE.md
|
|
95
|
+
!REFACTORING.md
|
|
96
|
+
!CHANGELOG.md
|
|
97
|
+
!LICENSE
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or use `files` field in package.json (recommended):
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"files": [
|
|
105
|
+
"faye-redis.js",
|
|
106
|
+
"README.md",
|
|
107
|
+
"CLAUDE.md",
|
|
108
|
+
"REFACTORING.md",
|
|
109
|
+
"LICENSE"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. Create Essential Files
|
|
115
|
+
|
|
116
|
+
**LICENSE** (if not exists):
|
|
117
|
+
```
|
|
118
|
+
MIT License
|
|
119
|
+
|
|
120
|
+
Copyright (c) 2011-2013 James Coglan (original faye-redis)
|
|
121
|
+
Copyright (c) 2026-present Community Contributors (faye-redis-ng)
|
|
122
|
+
|
|
123
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
124
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
125
|
+
in the Software without restriction, including without limitation the rights
|
|
126
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
127
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
128
|
+
furnished to do so, subject to the following conditions:
|
|
129
|
+
|
|
130
|
+
The above copyright notice and this permission notice shall be included in all
|
|
131
|
+
copies or substantial portions of the Software.
|
|
132
|
+
|
|
133
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
134
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
135
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
136
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
137
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
138
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
139
|
+
SOFTWARE.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**CHANGELOG.md**:
|
|
143
|
+
```markdown
|
|
144
|
+
# Changelog
|
|
145
|
+
|
|
146
|
+
All notable changes to faye-redis-ng will be documented in this file.
|
|
147
|
+
|
|
148
|
+
## [1.0.0] - 2026-01-07
|
|
149
|
+
|
|
150
|
+
### Added
|
|
151
|
+
- Initial release of faye-redis-ng (Next Generation fork)
|
|
152
|
+
- Redis v4 support with Promise-based API
|
|
153
|
+
- Automatic reconnection with exponential backoff
|
|
154
|
+
- ES6+ class syntax and modern JavaScript features
|
|
155
|
+
- Comprehensive error handling and logging
|
|
156
|
+
- Auto re-subscribe after reconnection
|
|
157
|
+
- Better documentation and examples
|
|
158
|
+
|
|
159
|
+
### Changed
|
|
160
|
+
- Upgraded from callback-based to async/await internally
|
|
161
|
+
- Updated from prototype-based to ES6 class
|
|
162
|
+
- Node.js requirement: >=14.0.0 (was >=0.4.0)
|
|
163
|
+
- All Redis commands updated to v4 API
|
|
164
|
+
|
|
165
|
+
### Improved
|
|
166
|
+
- Production-ready reconnection handling
|
|
167
|
+
- Better error messages and debugging
|
|
168
|
+
- Updated dependencies to latest versions
|
|
169
|
+
- Modernized codebase while maintaining backward compatibility
|
|
170
|
+
|
|
171
|
+
### Migration
|
|
172
|
+
- Drop-in replacement for original faye-redis
|
|
173
|
+
- No breaking changes to public API
|
|
174
|
+
- Simply replace `require('faye-redis')` with `require('faye-redis-ng')`
|
|
175
|
+
|
|
176
|
+
## Original faye-redis
|
|
177
|
+
|
|
178
|
+
This project is a modernized fork of [faye-redis](https://github.com/faye/faye-redis-node) by James Coglan.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Publishing Steps
|
|
182
|
+
|
|
183
|
+
### Step 1: Create npm Account (if you don't have one)
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm adduser
|
|
187
|
+
# or
|
|
188
|
+
npm login
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Step 2: Test Package Locally
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Test installation locally
|
|
195
|
+
npm pack
|
|
196
|
+
|
|
197
|
+
# This creates faye-redis-ng-1.0.0.tgz
|
|
198
|
+
# Test it in another project:
|
|
199
|
+
cd /path/to/test-project
|
|
200
|
+
npm install /path/to/faye-redis-ng-1.0.0.tgz
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Step 3: Verify Package Contents
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Check what will be published
|
|
207
|
+
npm publish --dry-run
|
|
208
|
+
|
|
209
|
+
# Review the output carefully
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Step 4: Run Final Checks
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Lint package.json
|
|
216
|
+
npm install -g npm-package-json-lint
|
|
217
|
+
npmPkgJsonLint .
|
|
218
|
+
|
|
219
|
+
# Or manually verify:
|
|
220
|
+
# - All dependencies are correct versions
|
|
221
|
+
# - No sensitive information in any files
|
|
222
|
+
# - README is complete
|
|
223
|
+
# - Version number is correct
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Step 5: Publish to npm
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Publish to npm (public)
|
|
230
|
+
npm publish --access public
|
|
231
|
+
|
|
232
|
+
# If you want to test first, publish to a scoped package:
|
|
233
|
+
# npm publish --access public --tag beta
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Step 6: Verify Publication
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Check on npm
|
|
240
|
+
npm view faye-redis-ng
|
|
241
|
+
|
|
242
|
+
# Install and test
|
|
243
|
+
npm install faye-redis-ng
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Post-Publishing
|
|
247
|
+
|
|
248
|
+
### 1. Create Git Tag
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
git tag v1.0.0
|
|
252
|
+
git push origin v1.0.0
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 2. Create GitHub Release
|
|
256
|
+
|
|
257
|
+
Go to your GitHub repository and create a release:
|
|
258
|
+
- Tag: `v1.0.0`
|
|
259
|
+
- Title: `v1.0.0 - Initial Release`
|
|
260
|
+
- Description: Copy from CHANGELOG.md
|
|
261
|
+
|
|
262
|
+
### 3. Update Documentation
|
|
263
|
+
|
|
264
|
+
- Add badges to README.md with actual npm package link
|
|
265
|
+
- Update homepage URL if needed
|
|
266
|
+
|
|
267
|
+
### 4. Announce
|
|
268
|
+
|
|
269
|
+
Consider announcing on:
|
|
270
|
+
- Twitter/X
|
|
271
|
+
- Reddit (r/node, r/javascript)
|
|
272
|
+
- Hacker News
|
|
273
|
+
- Dev.to
|
|
274
|
+
|
|
275
|
+
## Version Management
|
|
276
|
+
|
|
277
|
+
### Semantic Versioning
|
|
278
|
+
|
|
279
|
+
Follow [semver](https://semver.org/):
|
|
280
|
+
|
|
281
|
+
- **MAJOR**: Breaking changes (2.0.0)
|
|
282
|
+
- **MINOR**: New features, backward compatible (1.1.0)
|
|
283
|
+
- **PATCH**: Bug fixes, backward compatible (1.0.1)
|
|
284
|
+
|
|
285
|
+
### Publishing Updates
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# For patches (bug fixes)
|
|
289
|
+
npm version patch
|
|
290
|
+
npm publish
|
|
291
|
+
|
|
292
|
+
# For minor (new features)
|
|
293
|
+
npm version minor
|
|
294
|
+
npm publish
|
|
295
|
+
|
|
296
|
+
# For major (breaking changes)
|
|
297
|
+
npm version major
|
|
298
|
+
npm publish
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Troubleshooting
|
|
302
|
+
|
|
303
|
+
### Package Name Already Taken
|
|
304
|
+
|
|
305
|
+
If `faye-redis-ng` is taken, consider:
|
|
306
|
+
- `@yourscope/faye-redis-ng`
|
|
307
|
+
- `faye-redis-modern`
|
|
308
|
+
- `faye-redis-v4`
|
|
309
|
+
- `faye-redis-next`
|
|
310
|
+
|
|
311
|
+
### Can't Publish
|
|
312
|
+
|
|
313
|
+
Common issues:
|
|
314
|
+
1. **Not logged in**: Run `npm login`
|
|
315
|
+
2. **Name conflict**: Choose different name
|
|
316
|
+
3. **Version exists**: Bump version with `npm version patch`
|
|
317
|
+
4. **Email not verified**: Check npm email verification
|
|
318
|
+
|
|
319
|
+
## Security
|
|
320
|
+
|
|
321
|
+
### Before Publishing
|
|
322
|
+
|
|
323
|
+
- ✅ No API keys or secrets in code
|
|
324
|
+
- ✅ No .env files included
|
|
325
|
+
- ✅ Dependencies are from trusted sources
|
|
326
|
+
- ✅ Run `npm audit` and fix vulnerabilities
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
npm audit
|
|
330
|
+
npm audit fix
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### After Publishing
|
|
334
|
+
|
|
335
|
+
Set up:
|
|
336
|
+
- GitHub security alerts
|
|
337
|
+
- Dependabot
|
|
338
|
+
- npm 2FA for publishing
|
|
339
|
+
|
|
340
|
+
## Maintenance
|
|
341
|
+
|
|
342
|
+
### Keeping Updated
|
|
343
|
+
|
|
344
|
+
1. Monitor dependencies: `npm outdated`
|
|
345
|
+
2. Update dependencies regularly
|
|
346
|
+
3. Test before publishing updates
|
|
347
|
+
4. Keep CHANGELOG.md updated
|
|
348
|
+
5. Respond to issues and PRs
|
|
349
|
+
|
|
350
|
+
## Questions?
|
|
351
|
+
|
|
352
|
+
- npm documentation: https://docs.npmjs.com/
|
|
353
|
+
- Semantic versioning: https://semver.org/
|
|
354
|
+
- Package.json docs: https://docs.npmjs.com/cli/v10/configuring-npm/package-json
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
**Good luck with your first publish! 🚀**
|
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# faye-redis-ng
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/faye-redis-ng)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](https://github.com/YOUR-USERNAME/faye-redis-ng/actions)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
**Next Generation** Redis backend engine for [Faye](http://faye.jcoglan.com) - A modern, maintained fork with Redis v4 support, ES6+ syntax, and automatic reconnection.
|
|
9
|
+
|
|
10
|
+
## 🎉 What's New in NG (Next Generation)
|
|
11
|
+
|
|
12
|
+
This is a modernized fork of the original [faye-redis](https://github.com/faye/faye-redis-node) with significant improvements:
|
|
13
|
+
|
|
14
|
+
### ✨ Key Improvements
|
|
15
|
+
|
|
16
|
+
- ✅ **Redis v4 Support** - Uses modern Promise-based Redis client API
|
|
17
|
+
- ✅ **ES6+ Syntax** - Modern JavaScript with classes, async/await, const/let
|
|
18
|
+
- ✅ **Auto-Reconnection** - Automatic Redis reconnection with exponential backoff
|
|
19
|
+
- ✅ **Better Error Handling** - Comprehensive error logging and event triggers
|
|
20
|
+
- ✅ **Node.js 22 LTS** - Updated for latest LTS Node.js version
|
|
21
|
+
- ✅ **Zero Breaking Changes** - Drop-in replacement for original faye-redis
|
|
22
|
+
|
|
23
|
+
### 🔄 Why This Fork?
|
|
24
|
+
|
|
25
|
+
The original `faye-redis` hasn't been updated since 2015 and uses deprecated dependencies. This fork brings it up to modern standards while maintaining 100% backward compatibility.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install faye-redis-ng
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
This is a **drop-in replacement** for the original `faye-redis`. Simply change the require statement:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// Before (old faye-redis)
|
|
39
|
+
const redis = require('faye-redis');
|
|
40
|
+
|
|
41
|
+
// After (faye-redis-ng)
|
|
42
|
+
const redis = require('faye-redis-ng');
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Complete example:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const faye = require('faye');
|
|
49
|
+
const redis = require('faye-redis-ng');
|
|
50
|
+
const http = require('http');
|
|
51
|
+
|
|
52
|
+
const server = http.createServer();
|
|
53
|
+
|
|
54
|
+
const bayeux = new faye.NodeAdapter({
|
|
55
|
+
mount: '/',
|
|
56
|
+
timeout: 25,
|
|
57
|
+
engine: {
|
|
58
|
+
type: redis,
|
|
59
|
+
host: 'redis.example.com',
|
|
60
|
+
port: 6379,
|
|
61
|
+
password: 'your-password', // optional
|
|
62
|
+
namespace: 'faye', // optional
|
|
63
|
+
database: 0 // optional
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
bayeux.attach(server);
|
|
68
|
+
server.listen(8000);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration Options
|
|
72
|
+
|
|
73
|
+
All original configuration options are supported:
|
|
74
|
+
|
|
75
|
+
| Option | Type | Default | Description |
|
|
76
|
+
|--------|------|---------|-------------|
|
|
77
|
+
| `host` | String | `'localhost'` | Redis server hostname |
|
|
78
|
+
| `port` | Number | `6379` | Redis server port |
|
|
79
|
+
| `password` | String | `undefined` | Redis password (if `requirepass` is set) |
|
|
80
|
+
| `database` | Number | `0` | Redis database number |
|
|
81
|
+
| `namespace` | String | `''` | Prefix for all Redis keys (allows multiple Faye instances) |
|
|
82
|
+
| `socket` | String | `undefined` | Unix socket path (alternative to host/port) |
|
|
83
|
+
| `gc` | Number | `60` | Garbage collection interval in seconds |
|
|
84
|
+
|
|
85
|
+
## New Features
|
|
86
|
+
|
|
87
|
+
### Automatic Reconnection
|
|
88
|
+
|
|
89
|
+
The NG version includes production-ready reconnection handling:
|
|
90
|
+
|
|
91
|
+
- **Exponential backoff**: 100ms, 200ms, 300ms ... up to 10s
|
|
92
|
+
- **Max retries**: 20 attempts (~2 minutes) before giving up
|
|
93
|
+
- **Auto re-subscribe**: Pub/sub channels automatically re-subscribed after reconnection
|
|
94
|
+
- **State tracking**: Operations pause during reconnection and resume when ready
|
|
95
|
+
|
|
96
|
+
Example reconnection logs:
|
|
97
|
+
```
|
|
98
|
+
Redis reconnecting in 100ms (attempt 1)
|
|
99
|
+
Redis reconnecting in 200ms (attempt 2)
|
|
100
|
+
...
|
|
101
|
+
Redis subscriber ready
|
|
102
|
+
Redis client ready
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Better Error Handling
|
|
106
|
+
|
|
107
|
+
All connection errors are logged and trigger events to your Faye server:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
bayeux.bind('error', function(error) {
|
|
111
|
+
console.error('Redis error:', error);
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Migrating from faye-redis
|
|
116
|
+
|
|
117
|
+
**No code changes required!** Just update your package.json:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm uninstall faye-redis
|
|
121
|
+
npm install faye-redis-ng
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Update your require statement and you're done:
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const redis = require('faye-redis-ng');
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Requirements
|
|
131
|
+
|
|
132
|
+
- **Node.js**: >= 22.0.0 (LTS)
|
|
133
|
+
- **Redis**: >= 2.8.0 (tested with Redis 6.x and 7.x)
|
|
134
|
+
- **Faye**: >= 1.0.0
|
|
135
|
+
|
|
136
|
+
## Architecture
|
|
137
|
+
|
|
138
|
+
This engine implements the Faye engine interface and uses Redis for:
|
|
139
|
+
|
|
140
|
+
- **Client storage**: Sorted set with last-ping timestamps
|
|
141
|
+
- **Subscriptions**: Sets tracking client-channel relationships
|
|
142
|
+
- **Message queues**: Lists storing queued messages per client
|
|
143
|
+
- **Pub/Sub**: Channels for message notifications and client disconnections
|
|
144
|
+
- **Distributed locking**: For garbage collection coordination
|
|
145
|
+
|
|
146
|
+
See [CLAUDE.md](./CLAUDE.md) for detailed architecture documentation.
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Install dependencies (includes Faye submodule)
|
|
152
|
+
make prepare
|
|
153
|
+
|
|
154
|
+
# Run tests (requires Redis server running)
|
|
155
|
+
npm test
|
|
156
|
+
|
|
157
|
+
# Or run integration tests
|
|
158
|
+
node test-integration.js
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Testing
|
|
162
|
+
|
|
163
|
+
The test suite requires a running Redis server. For local development:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Start Redis with password
|
|
167
|
+
redis-server --requirepass foobared
|
|
168
|
+
|
|
169
|
+
# Run tests
|
|
170
|
+
npm test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Changes from Original
|
|
174
|
+
|
|
175
|
+
See [REFACTORING.md](./REFACTORING.md) for complete details on modernization changes.
|
|
176
|
+
|
|
177
|
+
**Summary**:
|
|
178
|
+
- Upgraded from callback-based Redis to Promise-based Redis v4
|
|
179
|
+
- Converted from prototype-based to ES6 class syntax
|
|
180
|
+
- Added automatic reconnection with exponential backoff
|
|
181
|
+
- Modern JavaScript: const/let, arrow functions, async/await
|
|
182
|
+
- Improved error handling and logging
|
|
183
|
+
- Updated all dependencies to current versions
|
|
184
|
+
|
|
185
|
+
## Credits
|
|
186
|
+
|
|
187
|
+
- **Original Author**: [James Coglan](http://jcoglan.com/) - Created the original faye-redis
|
|
188
|
+
- **This Fork**: Modernized and maintained by the community
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT License - Same as the original faye-redis
|
|
193
|
+
|
|
194
|
+
## Contributing
|
|
195
|
+
|
|
196
|
+
Contributions are welcome! This is a community-maintained fork. Please:
|
|
197
|
+
|
|
198
|
+
1. Fork the repository
|
|
199
|
+
2. Create a feature branch
|
|
200
|
+
3. Make your changes with tests
|
|
201
|
+
4. Submit a pull request
|
|
202
|
+
|
|
203
|
+
## Related Projects
|
|
204
|
+
|
|
205
|
+
- [Faye](http://faye.jcoglan.com/) - Simple pub/sub messaging for the web
|
|
206
|
+
- [Redis](https://redis.io/) - In-memory data structure store
|
|
207
|
+
|
|
208
|
+
## Support
|
|
209
|
+
|
|
210
|
+
- **Issues**: [GitHub Issues](http://github.com/faye/faye-redis-node/issues)
|
|
211
|
+
- **Original Project**: [faye-redis](https://github.com/faye/faye-redis-node)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
**Made with ❤️ by the community** | Keeping faye-redis modern and maintained
|