SlideShare a Scribd company logo
3
Most read
7
Most read
Creating a WhatsApp Clone - Part I
In this module we’ll build a rudimentary whatsapp clone. I’ll take a very different path when compared to previous cloned applications here
Deconstruction
✦How is this clone different
✦UI
✦Identity and verification
✦Technology
✦Protocol – WebService, WebSocket & Push
© Codename One 2017 all rights reserved
We’ll talk about that and these things in the next few slides
How is this Clone Different?
✦Not pixel perfect – fast & dirty
✦Barebone functionality
✦Skipped things mentioned in other modules
© Codename One 2017 all rights reserved
The first thing I’d like to go into is that this clone isn’t pixel perfect, this is a “fast and dirty” clone. 

I’ll focus only on the basic text sending functionality and don’t go into nearly as much detail as I did in the other clones. Frankly, it’s not necessary. The functionality is
simple once you understand the facebook clone.

I skipped a lot of the core features mostly due to time. But also because these features are covered in the facebook clone and re-implementing them for yet another
clone would have been redundant.
UI
© Codename One 2017 all rights reserved
I’ll only focus on these forms, I won’t implement everything here either
Identity and Verification
© Codename One 2017 all rights reserved
Since we already implemented SMS verification in the facebook clone I’ll just use the SMS activation library. However, I’ll use server side authentication for that library for
extra security.

WhatsApp doesn’t use passwords. I considered using the phone number as the ID which seems to be what they are doing. I ended up using a regular ID though. There is
an authorization token which I will discuss later.
Technology
✦Spring Boot
✦MySQL
✦JSON Storage & Protocol
© Codename One 2017 all rights reserved
Like the other clones I’ll use Spring Boot again. That makes this familiar and allows me to grab some code from the other projects

The database will be mysql again for the same reason

I’ll store data as JSON locally instead of sqlite. This makes it easy to use and debug the code. That might be something worth changing if you are building this for scale
Protocol
✦WebServices for most communication
✦Messaging uses websockets
✦Push as fallback if a socket is offline
✦JSON is used for websocket data
© Codename One 2017 all rights reserved
I’m still using webservices for most of the functionality. They are still easier to work with than websockets

However, messaging is the ideal use case for websockets and I’m using it for that exact purpose

When the websocket is closed, which would happen if the app isn’t running or is minimized, I use push. Push is used strictly as a visual medium to notify the user of a
new message. 

When sending/receiving data in websockets I use JSON. In the past I used a binary websocket and I wanted to show how this approach works as well.
apache.org/POM/4.0.0 http://maven.apache.org/xsd/
maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>com.codename1.whatsapp.server</groupId>
<artifactId>WhatsApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>WhatsApp</name>
<description>WhatsApp Clone Server</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
pom.xml
So lets start by creating the springboot project for the server. I’m assuming you went through the previous modules and I won’t repeat myself too much.

You can use the spring boot initializer, which I used to create this pom file. I just defined a new project with this package for Java 8.
<name>WhatsApp</name>
<description>WhatsApp Clone Server</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
pom.xml
We’ll use JPA to communicate with the mySQL database
<name>WhatsApp</name>
<description>WhatsApp Clone Server</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
pom.xml
We use jersey for POJO/json serialization
<name>WhatsApp</name>
<description>WhatsApp Clone Server</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
pom.xml
The security package allows us to encrypt credentials into the database. It has a lot of other features but they aren’t as useful for us
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
pom.xml
We need web services support too
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
pom.xml
And websockets to implement the full communication protocol
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
pom.xml
The underlying Database is mysql so we need the right drivers for that
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.8.2.Final</version>
</dependency>
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio</artifactId>
<version>7.17.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml
And finally we need the server side twilio library to implement SMS support on the server. This will be used for the activation code functionality
Client Project
© Codename One 2017 all rights reserved
Next we need to create the client application which I create as WhatsAppClone
Client Project
© Codename One 2017 all rights reserved
I use the default native & barebones settings in the IDE. I pick the com.codename1.whatsapp package. Nothing special. Next we’ll go into the classes that implement the
client functionality

More Related Content

PPTX
Bootstrap 5 ppt
PDF
Files and streams
PPTX
Overloading and overriding in vb.net
PPTX
Presentation of bootstrap
PDF
Bootstrap 5 basic
PPTX
Student Result Management System
PPT
Java applets
Bootstrap 5 ppt
Files and streams
Overloading and overriding in vb.net
Presentation of bootstrap
Bootstrap 5 basic
Student Result Management System
Java applets

What's hot (20)

PDF
Xml schema
PPTX
Operating system architecture
PPTX
Super keyword in java
PPTX
SQLite database in android
PPTX
Introduction to HTML5 Canvas
PPTX
Concurrency control
PPTX
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
PPTX
Basics of JAVA programming
PPT
JavaScript Tutorial
PPT
Java beans
PPTX
PHP COOKIES AND SESSIONS
PPTX
Javascript event handler
PDF
Servlet and servlet life cycle
PPTX
Xml dtd
PPTX
Bootstrap PPT Part - 2
PDF
Html table tags
PDF
Bootstrap
PPT
Database Triggers
Xml schema
Operating system architecture
Super keyword in java
SQLite database in android
Introduction to HTML5 Canvas
Concurrency control
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
Basics of JAVA programming
JavaScript Tutorial
Java beans
PHP COOKIES AND SESSIONS
Javascript event handler
Servlet and servlet life cycle
Xml dtd
Bootstrap PPT Part - 2
Html table tags
Bootstrap
Database Triggers
Ad

Similar to Creating a Whatsapp Clone - Part I - Transcript.pdf (20)

PDF
Creating a Whatsapp Clone - Part I.pdf
PDF
Web driver selenium simplified
PDF
create-netflix-clone-02-server_transcript.pdf
PDF
Creating a Facebook Clone - Part XVII - Transcript.pdf
PDF
Introduction to Docker and Containers- Learning Simple
PDF
Creating a Facebook Clone - Part II - Transcript.pdf
PPTX
Future proofing design work with Web components
PDF
GiordanoArman-Technicaldescription (1)
PDF
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
PDF
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
PDF
No Hugging, No Learning
ODP
Pyramid tutorial
PDF
WebSocket Push Fallback - Transcript.pdf
PDF
RubyMotion Inspect Conference - 2013. (With speaker notes.)
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PDF
Multi-threaded web crawler in Ruby
KEY
Synchronous Reads Asynchronous Writes RubyConf 2009
PDF
StackMob & Appcelerator Module Part One
PDF
Ember. it is time to try
PDF
Create Your Own Framework by Fabien Potencier
Creating a Whatsapp Clone - Part I.pdf
Web driver selenium simplified
create-netflix-clone-02-server_transcript.pdf
Creating a Facebook Clone - Part XVII - Transcript.pdf
Introduction to Docker and Containers- Learning Simple
Creating a Facebook Clone - Part II - Transcript.pdf
Future proofing design work with Web components
GiordanoArman-Technicaldescription (1)
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
No Hugging, No Learning
Pyramid tutorial
WebSocket Push Fallback - Transcript.pdf
RubyMotion Inspect Conference - 2013. (With speaker notes.)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Multi-threaded web crawler in Ruby
Synchronous Reads Asynchronous Writes RubyConf 2009
StackMob & Appcelerator Module Part One
Ember. it is time to try
Create Your Own Framework by Fabien Potencier
Ad

More from ShaiAlmog1 (20)

PDF
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
PDF
create-netflix-clone-06-client-ui.pdf
PDF
create-netflix-clone-01-introduction_transcript.pdf
PDF
create-netflix-clone-04-server-continued_transcript.pdf
PDF
create-netflix-clone-01-introduction.pdf
PDF
create-netflix-clone-06-client-ui_transcript.pdf
PDF
create-netflix-clone-03-server.pdf
PDF
create-netflix-clone-04-server-continued.pdf
PDF
create-netflix-clone-05-client-model_transcript.pdf
PDF
create-netflix-clone-03-server_transcript.pdf
PDF
create-netflix-clone-02-server.pdf
PDF
create-netflix-clone-05-client-model.pdf
PDF
Creating a Whatsapp Clone - Part II.pdf
PDF
Creating a Whatsapp Clone - Part IX - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part II - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part V - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part IV - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part IV.pdf
PDF
Creating a Whatsapp Clone - Part IX.pdf
PDF
Creating a Whatsapp Clone - Part VI.pdf
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-01-introduction.pdf
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-03-server.pdf
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-02-server.pdf
create-netflix-clone-05-client-model.pdf
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IX.pdf
Creating a Whatsapp Clone - Part VI.pdf

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25 Week I
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Understanding_Digital_Forensics_Presentation.pptx

Creating a Whatsapp Clone - Part I - Transcript.pdf