wildchat

0.6.0 • Public • Published

demo-js-wildchat — Wilddog 开源实时聊天应用

Wildchat 是使用 Wilddog 一个开源的、实时的聊天应用。它提供完全多用户,多房间,用户搜索,站内短信,聊天邀请等等。

在线示例

访问 wildchat.wilddogapp.com 查看 Wildchat 在线示例.

 在 Wildchat 演示聊天截图

在线文档

 在 Wildchat 在线文档

下载

Wildchat 工作原理简单,前提是在你的应用程序正确的依赖它,并配置 Wilddog 帐户系统。 为了在你的项目使用 Wildchat, 需要包括 HTML 在内的以下文件:

<!-- jQuery -->
<script src='http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js'></script>
 
<!-- Wilddog -->
<script src='https://cdn.wilddog.com/sdk/js/2.3.9/wilddog.js'></script>
 
<!-- Wildchat -->
<link rel='stylesheet' href='https://cdn.wilddog.com/app/wildchat/0.6.0/wildchat.min.css' />
<script src='https://cdn.wilddog.com/app/wildchat/0.6.0/wildchat.min.js'></script>

使用上面提到的URL可以从Wilddog的CDN上下载到Wildchat的精简版和非精简版。你也可以从Wilddog的Github中下载他们。当然啦,Wilddog可以在官网上下载。

你也可以通过npm 或者 bowr安装Wildchat, 他们会自动下载依赖。

$ npm install wildchat --save
$ bower install wildchat --save

示例代码

  • 添加用户登录
<script>
// Create a new Wilddog reference, and a new instance of the Login client
var config = {
  authDomain: "<appId>.wilddog.com",
  syncURL: "https://<appId>.wilddogio.com",
};
wilddog.initializeApp(config);
 
var chatRef = wilddog.sync();
var auth = wilddog.auth();
var weiboProvider = new wilddog.auth.WeiboAuthProvider();
 
function login() {
  wilddog.auth().signInWithPopup(weiboProvider).then(function (user) {
    //  一旦通过验证,Wildchat实例携带我们的用户ID和用户名
    initChat(user);
  }).catch(function (error) {
     console.log(error);
  });
}
 
</script>
 
<a href='#' onclick='login();'>登录微博</a>
  • 初始化一个聊天。
<script>
function initChat(authData) {
  var chat = new WildchatUI(chatRef, document.getElementById('wildchat-wrapper'));
  chat.setUser(authData.uid, authData.displayName);
}
</script>
 
<div id='wildchat-wrapper'></div>

注册Wilddog

Wildchat 需要 Wilddog 来同步和存储数据。您可以在这里注册一个免费帐户。

更多示例

这里分类汇总了 WildDog平台上的示例程序和开源应用, 链接地址:https://github.com/WildDogTeam/wilddog-demos

支持

如果在使用过程中有任何问题,请提 issue ,我会在 Github 上给予帮助。

相关文档

License

MIT http://wilddog.mit-license.org/

感谢 Thanks

demo-js-wildchat is built on and with the aid of several projects. We would like to thank the following projects for helping us achieve our goals:

Open Source:

  • firechat Real-time Chat powered by Firebas
  • JQuery The Write Less, Do More, JavaScript Library

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.6.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.6.0
    0
  • 0.5.0
    0

Package Sidebar

Install

npm i wildchat

Weekly Downloads

0

Version

0.6.0

License

ISC

Last publish

Collaborators

  • starport.ops