mean-expert-official / loopback-component-pubsub

DEPRECATED: Use @mean-expert/loopback-component-realtime instead.
https://www.npmjs.com/package/@mean-expert/loopback-component-realtime
11 stars 2 forks source link

Where does require("./pubsub") come from? #14

Closed penguinpowernz closed 8 years ago

penguinpowernz commented 8 years ago

In the index there is a require("./pubsub") line, but there is no relevant file in the repo.

Where does this come from?

I notice in my node_modules folder that file pubsub.js has magically appeared.

jonathan-casarrubias commented 8 years ago

Hi @penguinpowernz thanks for reaching me out.. I would recommend to better use the loopback-component-realtime that replaces this module.

I'm in the process of deprecating this module in favor of the mentioned above, which also includes PubSub functionality but other 2 types of Real-time functionalities.

Cheers Jon

penguinpowernz commented 8 years ago

Can I ask why you made this decision?

jonathan-casarrubias commented 8 years ago

@penguinpowernz sure... Due to some LoopBack limitations and to provide a more integral solution, since in order to achieve the PubSub pattern I can only hook on remoteHooks (and not operation hooks)... This means that you necessarily need to make an HTTP Request through the REST API to fire an event.

This obviously is a big limitation -and overhead-, there are many cases in which this module is fine, but there are multiple other cases that you would need to directly send messages from the back end and not using the REST Interface.

Also, making HTTP Requests to persist data is kind of unnecessary when you already have 1 open connection through WebSockets.

So.... If you use the new module, you would get the exact same PubSub functionality plus many other faster Real-time type of communications (PubSub, FireLoop, Custom Messaging and WebRTC), all of them using a single connection, sharing drivers, security, base code and even types -since the new module is written in TypeScript-.

But I can say this module is fully included within the new one, any code related with this is already included in the other one.

Cheers Jon

penguinpowernz commented 8 years ago

Thanks for the clarification @jonathan-casarrubias