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.
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
- Download xserv-chat-widget and try out the included JavaScript example apps.
##Installation
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
<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>
<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>
<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>
For private topic do you need replace a topic string with a JSON like:
{topic: "@example_name", user: "user", pass: "pass"}
widget.addEventListener("widget_open", function(json) {
});
widget.addEventListener("widget_close", function(json) {
});
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
Xserv is owned and maintained by the [mobile-italia.com] (http://mobile-italia.com).
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.
Xserv is released under the GNU General Public License Version 3. See LICENSE for details.