silkjs / tedis

redis client with typescript and esnext for nodejs
https://tedis.silkjs.org
MIT License
148 stars 19 forks source link

Connect with a function instead of immediately #47

Open pedrofracassi opened 4 years ago

pedrofracassi commented 4 years ago

Due to the way our project is structured, we're registering events in an async way, which leads to the first connection events not being listened to. If possible, could you add a .connect() function that allows us to connect after creating the client?

This would allow us to create the client, wait for the events to be registered and then connect.

Thank you so much!

danielfroz commented 4 years ago

@pedrofracassi not sure if helps... but considered that you cloned the fork I created, it already does what you're asking. Simple base example using connect can be found here: https://github.com/danielfroz/tedis/blob/master/src/tedis_base_command.spec.ts If you need help, open an Issue under my project I will help you to set it up.

pedrofracassi commented 4 years ago

@danielfroz It seems to do exactly what I need, yes! Could you publish it to npm? Tried installing it by using npm install github:danielfroz/tedis, but it didn't work, probably due to it being made in TypeScript.

danielfroz commented 4 years ago

@pedrofracassi I don't think that is a good idea to publish both projects under npm. I am using it today under my own NPM private registry. That's why I mentioned if you want help, I can assist you to set it up. Other possibility is for you to use locally and point your package.json to the local project. Both will work.

pedrofracassi commented 4 years ago

I think you can publish it under @danielfroz/tedis just fine

danielfroz commented 4 years ago

Right. But as stated I rather prefer to not duplicate projects... I truly believe that a single project with all nice features would be beneficial to everyone. HOWEVER, I don't see any action taken by @dasoncheng on all these discussions... Honestly I am not even sure if this project is worth the time of getting involved. The fact is that I am really busy these days and can't dedicate time to anything else. So let's see what @dasoncheng wants to do - if no answer, then I may take the ownership of this and create a new project based on Tedis (again something that I don't want to do).