Giter Club home page Giter Club logo

pager-chat's Introduction

Pager Chat Exercise

Overview

Hello! As part of the interview process, we'd like you to create a realtime chat application based on the specifications outlined below.

We provide this assignment to candidates so they can think about a problem in a close-to-real-work setting. We find that it takes about 4 to 6 hours to complete this exercise. We are providing this as a guidance on the level of effort that this exercise may require, not to place any time limits.

You should be prepared to discuss your approach with one of our engineers during your interview.

Requirements

  • Use React or Vue
  • Use cli tools such as create-react-app or vue-cli, but make sure you understand what this is providing
  • Integrate with BE service provided: https://pager-hiring.herokuapp.com/?username=<username>. Documentation for this service is provided below.

Design

  • Design can be accessed here

Features

  • User should be prompted to provide a username when accessing the application
  • User should be able to send and receive messages in real time
  • User should be able to view messages per design and it should get updated in real time
  • User should be able to scroll and see previous messages (includes messages that were sent while the user was disconnected)
  • User should see <username> is typing... indicator. If more than one person is typing, then indicate that People are typing...
  • Use https://ui-avatars.com/ to generate avatar with initials
  • Giphy API integration: during chat, any user can send and receive an animated gif url from the service via /gif <query> command. Do not use any third party library for this part.

Submission

Your submission should:

  • Implement the design and features per specifications.
  • Demonstrate your ability to architect a project from the ground up, design extensible components, and handle scalability.
  • Avoid excessive use of third party code. We value your understanding of the language, not the ability to use different libraries.

Your code should go into a public Github repo and a working release should be deployed to a cloud platform such as Heroku, Firebase, Netlify, Now, or other of your preference. We will run your submission in the latest version of Chrome so it does not need to support other browsers.

Please email a link to the repo and the hosted application to [email protected] at least 48 hours prior to your interview. This will give the interviewer time to review the submission and prepare for the discussion.

Happy coding!

wow

Server API

  • The server uses socket.io and is running on https://pager-hiring.herokuapp.com/?username=<username>.
  • You should use socket.io-client library to connect to it.
  • The client have to provide an <username> as a query parameter, otherwise the server will disconnect the client.

Server events

Those are the events that you should listen for.

user-connected

socket.on('user-connected', username => {
  // <username> is a string with the name of the user who connect to the chat
})

user-disconnected

socket.on('user-disconnected', username => {
  // <username> is a string with the name of the user who disconnect from the chat
})

is-typing

socket.on('is-typing', typers => {
  // <typers> is a map where the `key` is the <username> and the value is a `boolean` that is `true` if the user is typing and `false` if not.
  typers = {
    [username: string]: boolean
  }
})

message

socket.on('message', message => {
  // <message> is an object with one of the following schemas:
  message = {
    type: 'text',
    username: string,
    time: Date,
    text: string
  };
  // or
  message = {
    type: 'image',
    username: string,
    time: Date,
    url: string,
    alt: string | null
  };
})

Client events

Those are the events that you should send.

text-message

// <text> is the text of the message
socket.emit('text-message', text: string);

image-message

// <url> is a string with the image location
// <alt> is an **optional** text represatation of the image 
socket.emit('image-message', {url: string, [alt: string]});

typing

// <status> is a boolean that should be true if the user is actually typing or false if not
socket.emit('typing', status: boolean);

Testing our Socket.IO server

We can suggest this web interface: https://amritb.github.io/socketio-client-tool/#url=aHR0cHM6Ly9wYWdlci1oaXJpbmcuaGVyb2t1YXBwLmNvbS8/dXNlcm5hbWU9Y2FuZGlkYXRl&opt=&events=user-connected,user-disconnected,is-typing

pager-chat's People

Contributors

do-diegoortiz avatar

Watchers

James Cloos 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.