Giter Site home page Giter Site logo

chatkit-sample-client's Introduction

Chatkit Sample Client

Slack clone powered by Chatkit. See it in action here: chatkit-sample.netlify.com. This project was forked from React Slack Clone.

This is a static, single page web app bootstrapped with create-react-app for ease of setup, distribution and development. It is a thin UI wrapper around the pusher-chatkit-client library to demonstrate how different features can work together to form a compelling real-time chat client with various potential product applications.

Features

The Chatkit SDK allows you to implement features you would expect from a chat client. These include:

  • ๐Ÿ“ Public and private chat rooms
  • ๐Ÿ“ก Realtime sending and receiving of messages
  • ๐Ÿ“ฆ Rich media attachments (drag and drop)
  • ๐Ÿ’ฌ Typing and presence indicators
  • ๐Ÿ“š Read message cursors

Components

The demo attempts to be feature complete according to documentation here. Feature requests should be made via issues or pull requests to this repository.

  • CreateMessageForm - to send a message with a textual body and trigger typing indicators.
  • CreateRoomForm - to create a new room and join it upon creation.
  • FileInput - to send a message with a rich media attachment.
  • Message - to render out a message that potentially includes an attachment.
  • MessageList - to render a list of messages from a key value store.
  • RoomHeader - to display useful information about a given room.
  • RoomList - to render a list of rooms which can be subscribed to by the current user.
  • TypingIndicator - to signify to the user that another user is typing in a given room.
  • UserHeader - to display useful information about a given user.

Usage / Deployment

Follow these steps to set up Chatkit and Auth0 and deploy everything on Netlify.

Deploy to Netlify

  1. Fork this repo.

  2. Sign up for Chatkit and Auth0, and create apps/instances in both.

  3. In the Chatkit dashboard use the console to create a new public room, and note the room ID.

  4. Go to Netlify, and set up a new site there, pointing to your new fork.

  5. In Netlify site settings, set the build command as: npm run predeploy, and the publish directory as build/.

  6. Set up the following environment variables in Netlify, based on the keys and secrets from your Chatkit instance and Auth0 application: CHATKIT_INSTANCE_LOCATOR, CHATKIT_KEY AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, AUTH0_DOMAIN.

  7. Enable lambda functions in Netlify, set functions directory as ./lambda. This serves as our Chatkit authorizer that provides tokens to our applciation.

  8. In Auth0 dashboard's application settings make sure the app is set up as a Single Page Application

  9. Add the following to the Allowed Callback URLs section in the Auth0 dashboard: https://[YOUR_NETLIFY_APP_NAME].netlify.com

  10. Go to the Rules section in Auth0 dashboard, and update and add 2 rules - one for creating a Chatkit user after the first log in, and one to add that user to a room. As rules trigger after each log in, we need to make to make a condition that triggers only when login count is less than 1. You can copy the rules from rules/create-user.js, and rules/add-to-room.js.

  11. Add the following values as the settings in your rules:

  • chatkitInstanceLocator
  • chatkitSecret
  • chatkitRoomId
  1. Make a change, to trigger an update on Netlify (if it hasn't yet).
  2. Visit the deployed Netlify site at: https://YOUR_NETLIFY_SITE.netlif.com
  3. ๐Ÿš€

chatkit-sample-client's People

Contributors

zmarkan avatar

Watchers

 avatar  avatar

chatkit-sample-client's Issues

Crash when creating room

App crashes when you first create a room. Undefined fields and all that malarkey. Solves itself when you refresh.

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.