I am trying to include to Aurelia framework project sockets.io.
I have installed sockets by:
jspm install npm:socket.io
then, I would like to import:
import {io} from "socket.io";
And the results is:
GET http://localhost:9000/jspm_packages/npm/[email protected]/package.js 404 (Not Found)
Where is the problem? Why is there a reference to package.js and not to package.json or socket.io.js ?
On the client side (Aurelia), you should use the server.io client
import io from 'socket.io-client';
var socket = io('http://localhost:9000');
socket.emit('news', { hello: 'world' });
If your server is running socket-io then it will be serving up the client anyway. Thus, you should be able to add to the map section of your config.js file:
"socket.io" : "/socket.io/socket.io.js"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With