InnerWorld InnerWorld - 6 months ago 268
Node.js Question

import socket.io using system.js

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/socket.io-client@1.3.5/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
?

Answer

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' });