GithubHelp home page GithubHelp logo

randauto / android-mvp-realtime-chat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mayuroks/android-mvp-realtime-chat

0.0 2.0 0.0 3.77 MB

Android MVP Realtime Chat using RxJava and Socket.IO

License: MIT License

Java 100.00%

android-mvp-realtime-chat's Introduction

Socket Chat

A demo app to showcase Android MVP Realtime architecture.

Socket Chat is a demo app built using Android MVP Realtime architecture. You can read more about the architecture on my Medium article https://bit.ly/2KXcTan .

This app connects to Socket.IO chat room at https://socket-io-chat.now.sh. Suggestions for further improvements are most welcome.

Screenshot

Problem Statement

Most of us Android developers have created apps using the MVP architecture. A regular android app involves making HTTP API calls to the server, getting some data and rendering the view. Using these APIs, you can accomplish things like

  • Booking a cab
  • Ordering lunch
  • Transferring money etc.

As you can see, HTTP APIs are quite simple, scalable and you can get a lot of things done. Once you learn MVP with RxJava and Retrofit you are ready to take on the world with your amazing app. Yay!!

This feeling of awesomeness is quickly replaced by confusion the moment you try to build realtime apps like

  • Chat app
  • Multiplayer gaming app
  • Realtime stock price updates app etc.

Limitations of Android MVP

When I say Android MVP, I am referring to the Todo-MVP-RxJava example from googlesamples.

In this Android MVP example,

  • View is responsible for rendering the UI
  • Presenter is responsible for presenting the data
  • Repository is responsible for getting the data

This architecuture is based on request-response model, where the client requests for some resource from the server and the server sends back a response. But the other way round, where the server sends data to the client and the client handles the data, is not possible in the architecture. Simply because, the client is not actively listening for incoming data from the server.

Proposed Solution

So for the app to be realtime app, it should be able to send and receive events/data from the server. Based on this, if we try to draw an architecture, it would look some thing like this.

This Android project is an working implementation of the proposed Android MVP Realtime architecture.

Usage

If you want to try out the app, follow the below steps

This way you can send message between the app and the web chatroom.

Quick Demo

Check out this video on YouTube to see the app in action.

IMAGE ALT TEXT

NOTE: Sometimes, when you join a Socket.IO chat room on web, it might be a different chat room than the one to which the app is connected. I don't know what causes this since I am not the developer of Socket.IO web chat room.

Disclaimer

This is a side project app to experiment/play around with Android framework. This is not a production app. So there is no guarantee that issues/feature-requests/enhancements will be worked upon.

License

MIT


Github @mayuroks ~ Twitter @mayuroks ~ Medium @mayuroks

android-mvp-realtime-chat's People

Contributors

mayuroks avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.