-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis should not be a dependency #89
Comments
Hi! I could not reproduce the issue, both examples seem to work. That's a bit weird though:
But
I think it should even be in the const io = require('socket.io-emitter')(redisClient, { /* additional options */}); But this change would need to be well documented..
You should be able to create the emitter instance with a redis client v3 (the example above). |
The problem are the dependencies: I already have redis v3 in my project and this package imports redis v2. If I change redis for this package to v3 then it works. I think redis should at least be a peerDependency |
Hey @darrachequesne I see you updated the readme. Can we still remove redis from the dependencies and force the user to insert a client? |
Yes, let's do this 👍 |
The codebase is now written in TypeScript. Additional features: - https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Allow-excluding-specific-rooms-when-broadcasting - https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Additional-utility-methods - https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Typed-events BREAKING CHANGE: the "redis" package is not installed by default anymore, you'll now need to create your own redis client and pass it to the Emitter constructor Before: ```js const io = require("socket.io-emitter")({ host: "127.0.0.1", port: 6379 }); ``` After: ```js const { Emitter } = require("socket.io-emitter"); const { createClient } = require("redis"); const redisClient = createClient(); const io = new Emitter(redisClient); ``` Related: - #89 - #90 - #95
Done in a70db12. You'll now need to explicitly install the const { Emitter } = require("socket.io-emitter");
const { createClient } = require("redis");
const redisClient = createClient();
const io = new Emitter(redisClient); |
Thats nice! I did the same at nats-emitter https://github.com/MickL/socket.io-nats-emitter#readme |
May you add an example how to use with TypeScript? I tried both:
and
but i get:
Btw. should
redis
be a peerDependency? I already have Redis in my project (v3) and socket.io-emitter imports v2 so I have two instances running.The text was updated successfully, but these errors were encountered: