Skip to content

shamique/simple_chat_applcation

Repository files navigation

Introduction

This is a simple chat application developed using ionic

Refer below article for detail guidance (Recomended),
https://medium.com/@shamique/simple-chat-application-using-ionic-and-socket-io-82d9b4605cc3

Pre-requisite

  • NodeJs & ionic 2 installed in the machine

How to run ?

Chat Server

  • Create a directory for chat server and go to that folder
  • run npm init and initiate a new NodeJs project
  • Install socket.io: npm install socket.io --save
  • Create filename as server.js and add below code in it
  • var socket = require('socket.io'), http = require('http'),
    server = http.createServer(), socket = socket.listen(server);
    
    	socket.on('connection', function(connection) {
    		console.log('User Connected');
    
    		 connection.on('message', function(msg){
    			 socket.emit('message', msg);
    		 });
    	});
    
    	server.listen(3000, function(){
    		console.log('Server started');
    	});
    
  • Run the chat server: node server.js

Chat Client

  • Clone the repo to your machine
  • Go to the project folder and run npm install
  • run the project, ionic serve