- Notifications
You must be signed in to change notification settings - Fork1k
Real-time Chat powered by Firebase
License
FirebaseExtended/firechat
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Firechat is a simple, extensible chat widget powered byFirebase. It is intended to serve as a concise,documented foundation for chat products built on Firebase. It works out of the box, and is easilyextended.
This sample is no longer actively maintained and is left here for reference only.
Visitfirechat.firebaseapp.com to see a live demo of Firechat.
Firechat uses theFirebase Realtime Databaseas a backend, so it requires no server-side code. It can be added to any web app by including a fewJavaScript files:
<!-- jQuery --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script><!-- Firebase --><scriptsrc="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script><!-- Firechat --><linkrel="stylesheet"href="https://cdn.firebase.com/libs/firechat/3.0.1/firechat.min.css"/><scriptsrc="https://cdn.firebase.com/libs/firechat/3.0.1/firechat.min.js"></script>
giving your users a way to authenticate:
<script>functionlogin(){// Log the user in via Twittervarprovider=newfirebase.auth.TwitterAuthProvider();firebase.auth().signInWithPopup(provider).catch(function(error){console.log("Error authenticating user:",error);});}firebase.auth().onAuthStateChanged(function(user){// Once authenticated, instantiate Firechat with the logged in userif(user){initChat(user);}});</script><buttononclick="login()">Login with Twitter</button>
and initializing the chat:
<script>functioninitChat(user){// Get a Firebase Database refvarchatRef=firebase.database().ref("chat");// Create a Firechat instancevarchat=newFirechatUI(chatRef,document.getElementById("firechat-wrapper"));// Set the Firechat userchat.setUser(user.uid,user.displayName);}</script><divid="firechat-wrapper"></div>
For detailed integration instructions, see theFirechat documentation.
Firechat requires Firebase in order to authenticate users and store data. You cansign up here for a free account.
If you have a question about Firechat, feel free to reach out through one of ourofficial support channels.
About
Real-time Chat powered by Firebase
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors14
Uh oh!
There was an error while loading.Please reload this page.