Giter Club home page Giter Club logo

chat's Introduction

Chat

TODO

  • List conversations for user
  • Create conversation with another user
  • List messages in conversation
  • Create messages in conversation
  • Read status
  • Announcements This is a feature I'd really like to see in the product. It's a little jarring to see messages auto-sent from buyer and seller when a sale is made. Good fit for single table inheritance, allowing automated messages from neither participant or from moderators.
  • Multiple participants The pieces are all there. Group chat is only a controller change away.
  • Paginate collection endpoints

Regret not choosing names "thread" and "member" instead of "conversation" and "participation."

Payloads are minimal - without more endpoints, relies on client to keep some state to denormalize things like participating users.

Many-to-many participants makes for more expensive queries in some places but enables lots of features that would be difficult to implement without it. see: read receipts and group chat. It's a good fit for the product in question, for a more spastic chat app would need to consider backgrounding or caching in those places.

Getting Started

Requires ruby 2.4 and postgres 9.6. Set the DATABASE_ADDRESS DATABASE_USERNAME and DATABASE_PASSWORD environment variables to connect to your database. Alternatively use the included docker compose configuration and get started with docker-compose up.

Run rails db:create db:migrate then start the server. rails s

Usage

Provide the username param to requests to "authenticate." A user is created if one does not exist with that name.

curl 'http://chat.docker/api/conversations?username=xXjulianXx'
curl 'http://chat.docker/api/conversations?username=anth0ny'
curl -X POST 'http://chat.docker/api/conversations?username=xXjulianXx&to=anth0ny'
curl -X POST 'http://chat.docker/api/conversations/$CONVERSATION_ID/messages?username=xXjulianXx' \
  -H 'Content-Type: application/json' \
  --data '{ "message": { "body": "would you accept half your list price?" } }'
curl 'http://chat.docker/api/conversations/$CONVERSATION_ID/messages?username=anth0ny'

Testing

rspec

chat's People

Contributors

christianprescott avatar

Stargazers

Manuel Pineyro 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.