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:
# 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.
There are two components:
NickName
- for the welcome page that initiates socket client connectionChat
- for the chat page that depicts message flow between different sockets
There are mainly three sections of the Chat-component:
ChatBox
- for the interaction between different chat-Users/socket connectionsChatUsersList
- shows the currently active chat-Users/ScoketsChatUserAlerts
- shows the chat-user alerts for new user connection, dis-connected user and success for message passing
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
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.