• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    TypeScript
  • License
    Other
  • Created over 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Chat App built using Angular 2 and Node (Socket.io)

NOTICE: This repo has been deprecated

[DEPRECATED] Angular2 Chat App

An Angular 2 chat app using Angular 2, Node, socket.io, Express, SystemJS, TypeScript, Services, Injectables, Forms, Routing & Navigation, and tslint by GeekyAnts team

Note: This repo is no longer maintained.

This repo shows an example chat application using Socket.io, Node and Angular 2. The goal is to implement Socket Programming with Angular 2. It also features:

  • Express configuration with TypeScript, and tslint
  • Use of injectables, forms, routing & navigation services in Angular 2
  • Wiring together Angular2 client-side components with Socket.io and Express on the server.
  • And much more

View the chat-app GIF here:

Angular 2 Node Socket.io Chat

Quick start

# clone the repo
git clone https://github.com/start-angular/angular2-node-socket-io-chat-app.git 

# change into the repo directory
cd angular2-node-socket-io-chat-app

# install 
npm install

# run
npm start

Then visit http://localhost:3000 in your browser.

Architecture

Angular 2 Node Socket.io Chat

There are two components:

  • NickName - for the welcome page that initiates socket client connection
  • Chat - for the chat page that depicts message flow between different sockets

Angular 2 Node Socket.io Chat

Angular 2 Node Socket.io Chat

There are mainly three sections of the Chat-component:

  • ChatBox - for the interaction between different chat-Users/socket connections
  • ChatUsersList - shows the currently active chat-Users/Scokets
  • ChatUserAlerts - shows the chat-user alerts for new user connection, dis-connected user and success for message passing

Angular 2 Node Socket.io Chat

File Structure

Here's an overview of how the files are laid out in this project:

angular2-node-socket-io-chat-app/
|
โ”œโ”€โ”€ client/                         	* Where our Angular2 client code is stored
โ”‚   โ”œโ”€โ”€ chat-component/               * All of our chat-component files are here
โ”‚   โ”‚   โ”œโ”€โ”€ chat.component.ts       	* Chat Component
โ”‚   โ”‚   โ”œโ”€โ”€ chat.component.html     	* chat Component HTML
โ”‚   โ”‚   โ”œโ”€โ”€ chat.module.ts      		* chat module 
โ”‚   โ”‚   โ”œโ”€โ”€ chat.route.ts      		* chat component routes
โ”‚   โ”‚   โ””โ”€โ”€ index.ts       		    * index file for chat Component
|   |   
โ”‚   โ”œโ”€โ”€ nickName-component/           * All of our TypeScript is here
|   |	|
โ”‚   โ”‚   โ”œโ”€โ”€ nickName.component.ts 	* nickName Component
โ”‚   โ”‚   โ”œโ”€โ”€ nickName.component.html   * nickName Component HTML
โ”‚   โ”‚   โ”œโ”€โ”€ nickName.module.ts 		* nickName module
โ”‚   โ”‚   โ”œโ”€โ”€ nickName.route.ts 	    * nickName component routes
โ”‚   โ”‚   โ””โ”€โ”€ index.ts 					* index file for nickName Component
|   |   
โ”‚   โ”œโ”€โ”€ service/ 		      	      * service for all components
|   |	|
โ”‚   โ”‚   โ””โ”€โ”€ global.ts 		        * file with global attributes
|   |  
โ”‚   โ”œโ”€โ”€ app.component.html 			  * Home component HTML   
โ”‚   โ”œโ”€โ”€ app.component.ts 			  * Home component 
โ”‚   โ”œโ”€โ”€ app.module.ts                 * Aap Module  
โ”‚   โ”œโ”€โ”€ app.routing.ts                * App images  
โ”‚   โ””โ”€โ”€ main.ts            			  * Angular 2 Entry point  
|    
โ”œโ”€โ”€ public/							* Stores app images and gif
|	|
โ”‚   โ”œโ”€โ”€ Chat-Page.png       		  * chat page image
โ”‚   โ”œโ”€โ”€ chat-app.gif       		      * chat app gif
โ”‚   โ”œโ”€โ”€ ChatPage-Description.png      * chat page description image
โ”‚   โ”œโ”€โ”€ Sequence-Diagram.png      	  * app sequence diagram image
โ”‚   โ””โ”€โ”€ Welcome-page.png			  * welcome page image
|   
โ”œโ”€โ”€ server/             		        * Server side code (socket.io,express,node)
โ”‚   โ””โ”€โ”€ index.js       			      * Aap entry point
|
โ”œโ”€โ”€ typings/                          * tsd managed typings
โ”œโ”€โ”€ index.html                  	    * HTML entry point 
โ”œโ”€โ”€ styles.css                   		* Contains app CSS
โ”œโ”€โ”€ package.json                    	* Our javascript dependencies
โ”œโ”€โ”€ README.md                       	* This file
โ”œโ”€โ”€ systemjs.config.js                * syatemJS configuration file
โ”œโ”€โ”€ tsconfig.js                 	    * Some hacks to get TypeScript tests
โ”œโ”€โ”€ tslint.json                       * Configures our TypeScript linter
โ””โ”€โ”€ typings.json                      * Configures our TypeScript linter 

Known Issues

There is a issue with Windows systems. The directory path doesn't gets resolved correctly thereby creates compile issues with typecsript files. The app works fine on MAC and Linux systems. This issue will be resolved in coming weeks. Also If anyone finds a fix for the same, do send a pull request.