Giter VIP home page Giter VIP logo

xserv-chat-widget's Introduction

Xserv


This JavaScript widget allows you easily use Xserv WebSocket API for text and video/audio messaging on your site (integration with WebRTC).
Xserv provides a complete solution to implement the backend of all your applications such as web, mobile, desktop, embedded or otherwise.

Live Demo

Small Floating Widget (with toggle button) https://mobile-italia.com/xserv/try/widget/index.html

Multi-Client Widget https://mobile-italia.com/xserv/try/widget/index-full.html

How To Get Started

##Installation

Sign Up on Xserv

You need sign up on Xserv to get your app_id on Xserv Dashboard. That is an identifier of your application.

https://mobile-italia.com/xserv/dashboard/signup

Include dependecies

<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/widget.css">

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="https://mobile-italia.com/xserv/xserv.min.js"></script>
<script src="assets/js/widget.js"></script>

Init 1. small floating widget (with toogle button)

<script>
  $().ready(function() {
    var widget = new XservChatWidget(<app_id>, <topic>, "widget", "widget-toggle", "");
    // 'app_id' is an identifier of your application, You can found it on Xserv dashboard.
    // You need sign up on https://mobile-italia.com/xserv/dashboard/signup
    
    // 'topic' is the argument of discussion
    
    // last arg is a welcome message
  });
</script>

...

<div id="widget"></div>
<div id="widget-toggle"></div>

Init 2. multi-client widget (large, no floating, no toggle button)

<script>
  $().ready(function() {
    var widget = new XservChatWidget(<app_id>, <topic>, "widget", null, "");
    // 'app_id' is an identifier of your application, You can found it on Xserv dashboard.
    // You need sign up on https://mobile-italia.com/xserv/dashboard/signup
    
    // 'topic' is the argument of discussion
    
    // last arg is a welcome message
  });
</script>

...

<div id="widget"></div>

Init on Private Topic???

For private topic do you need replace a topic string with a JSON like:

{topic: "@example_name", user: "user", pass: "pass"}

Manage Widget toggle/connection events

widget.addEventListener("widget_open", function(json) {
  
});

widget.addEventListener("widget_close", function(json) {
  
});

Extra

If you want Xserv connector events.

widget.addEventListener("connection_open", function() {
  
});

widget.addEventListener("connection_close", function(event) {
  
});

widget.addEventListener("connection_error", function(event) {
  
});

widget.addEventListener("operations", function(json) {
  
});

widget.addEventListener("messages", function(json) {
  
});

If you want send a WebSocket API command to Xserv connector.

var xserv = widget.xserv; // widget.getXserv();
// some ex.
xserv.subscribe(topic);
xserv.unsubscribe(topic);
xserv.users(topic);
...

##Screnshot

An example of use on our site.

Live demo

Floating Widget with toggle button https://mobile-italia.com/xserv/try/widget/index.html

Multi-client Widget https://mobile-italia.com/xserv/try/widget/index-full.html

Credits

Xserv is owned and maintained by the [mobile-italia.com] (http://mobile-italia.com).

Security Disclosure

If you believe you have identified a security vulnerability with Xserv, you should report it as soon as possible via email to [email protected]. Please do not post it to a public issue tracker.

License

Xserv is released under the GNU General Public License Version 3. See LICENSE for details.

xserv-chat-widget's People

Contributors

xserv avatar amatig avatar

Stargazers

 avatar

Watchers

 avatar Giuseppe Nugara 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.