Here is how to run the code
Server: From the server folder
1-npm install
2-node server.js
Client: From the client folder
1-npm install
2-typings install
3-ng serve (assumes Angular CLI)
License: MIT License
java -jar ./closure-compiler/compiler.jar --compilation_level SIMPLE_OPTIMIZAT
IONS --language_in=ES6 --language_out=ES5 --js ./dist/temp.js --js_output_file d
ist/bundle.js
ERROR - Cannot read: ./dist/temp.js
1 error(s), 0 warning(s)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "run" "closure-compiler"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] closure-compiler: java -jar ./closure-compiler/comp iler.jar --compilation_level SIMPLE_OPTIMIZATIONS --language_in=ES6 --language_o ut=ES5 --js ./dist/temp.js --js_output_file dist/bundle.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] closure-compiler script 'java -jar ./c
losure-compiler/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --language
_in=ES6 --language_out=ES5 --js ./dist/temp.js --js_output_file dist/bundle.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-poc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! java -jar ./closure-compiler/compiler.jar --compilation_level SIMPL
E_OPTIMIZATIONS --language_in=ES6 --language_out=ES5 --js ./dist/temp.js --js_ou
tput_file dist/bundle.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-poc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-poc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Dev\WebEvalSamples\Angular\angular-2-samples\npm-debug.log
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "run" "install-application"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install-application: npm run clean && npm run aot & & npm run rollup && npm run closure-compiler
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install-application script 'npm run cl
ean && npm run aot && npm run rollup && npm run closure-compiler'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-poc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run clean && npm run aot && npm run rollup && npm run closure-c
ompiler
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-poc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-poc
npm ERR! There is likely additional logging output above.
Please consider upgrading the code to use the latest tools. I'm trying to kick the tires on Socket.io and thought your sample might help. Sadly it did not run given the ReadMe instructions. I am getting exceptions from ng-serve
suggesting issues with angular-cli and webpack.
Hello,
this is not an issue just a question.
In the chat.service.ts you have getMessage method and you are creating and returning a new Observable.
I am wondering. What if this method is implemented with Subject. Is that wrong?
example:
getMessagesSubject() {
this.socket = io(this.url);
let subject = new Subject();
this.socket.on('message', (data) => {
subject.next(data);
});
return subject;
}
ps: Awesome tutorial.
Hei Torgeir,
In my project i have more modules, and in one of them, the message module i have a service for messages.
I call the get messages method on my AppComponent. The problem is that when i console.log() the data that i get from getMessages() , it is empty , even that i send an object as data.
I guess the packages are changed to much
People could npm install --save
this and then just import
it :)
On browser socket works perfectly.
When I build the application in Ionic (both dev and prod modes) there isn't any socket connection.
Just curious It works without it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.