Xserv Real-Time Messaging. This JavaScript widget allows you easily use Xserv WebSocket API + WebRTC on your site.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
.gitignore
CHANGELOG.md
LICENSE
README.md
index-full.html
index.html
screenshot.png

README.md

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 xserv.dev@gmail.com. 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.