Hello,
I’m working on an Angular2/Sails.js solution that involves real time communication through the use of the Sail’s socket client.
This may be more of an Angular question but thought I would ask in the event others have insight.
In index.html, I’ve verified that the global io.socket object is available and functional as a result of including these two scripts.
<script type"text/javascript" src="node_modules/socket.io-client/socket.io.js"></script>
<script type"text/javascript" src="node_modules/sails.io.js/sails.io.js" ></script>
The challenge I’m faced with granting my Angular2 service component access to the global io.socket object.
I think the right solution is to add a global socket provider to boot.ts so that any of my services have access to the single persistent connection however I've not been successful at connecting the dots.
Boot.ts
bootstrap(AppComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS, SAILS_CONNECTION);
It’s probably simple, but how do I access the global io.socket object from an Angular class/component?
Thank you in advance.