Skip to content

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

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

Closed
penguinpowernz opened this issue Oct 3, 2016 · 4 comments
Closed

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

penguinpowernz opened this issue Oct 3, 2016 · 4 comments

Comments

@penguinpowernz
Copy link

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
Copy link
Collaborator

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
Copy link
Author

Can I ask why you made this decision?

@jonathan-casarrubias
Copy link
Collaborator

jonathan-casarrubias commented Oct 3, 2016

@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
Copy link
Author

Thanks for the clarification @jonathan-casarrubias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants