2016-09-20 12 views
-4

私は自分の既存のJava Webアプリケーションを運用しています(maven javaプロジェクト)。今度は、画面の右下に自分のアプリケーションにチャットを埋め込みたいと思います。それについてどうすればいいですか?チャットアプリケーションを追加するだけの簡単な方法、サンプル、APIはありますか?私のWebアプリケーションはログインしているユーザーにしか使えないので、私のアプリケーションにログインしているすべてのユーザーに、1対1でチャットしたり、チャットグループにチャットさせたいと思っています。ここでウェブアプリケーションでチャット

答えて

1

https://www.applozic.comチャットライブラリを使用してJavaScriptでサンプルチャットコードです:

https://jsfiddle.net/devashishmamgain/amjvszpp/

Javascriptを:

(function(d, m){var s, h; 
    s = document.createElement("script"); 
    s.type = "text/javascript"; 
    s.async=true; 
    s.src="https://apps.applozic.com/sidebox.app"; 
    h=document.getElementsByTagName('head')[0]; 
    h.appendChild(s); 
    window.applozic=m; 
    m.init=function(t){m._globals=t;}})(document, window.applozic || {}); 

    window.applozic.init({ 
    appId: 'applozic-sample-app',  //Get your application key from https://www.applozic.com 
    userId: 'jsfiddle',      //Logged in user's id, a unique identifier for user 
    userName: 'JSFiddler',     //User's display name 
    imageLink : '',      //User's profile picture url 
    email : '', 
    contactNumber: '', 
    desktopNotification: true, 
    notificationIconLink: 'https://www.applozic.com/favicon.ico', //Icon to show in desktop notification 
    onInit : function(response) { 
     if (response === "success") { 
      // login successful, perform your actions if any, for example: load contacts, getting unread message count, etc 
     } else { 
      // error in user login/register (you can hide chat button or refresh page) 
     } 
    }, 
    contactDisplayName: function(otherUserId) { 
     //return the display name of the user from your application code based on userId. 
     return ""; 
    }, 
    contactDisplayImage: function(otherUserId) { 
     //return the display image url of the user from your application code based on userId. 
     return ""; 
    } 
    }); 

HTML:

Open this fiddle in another tab and put userId: "jsfiddle2" in javascritp section and data-mck-id="jsfiddle1" in html a hyperlink below 

<br><br> 
<a href="#" class="applozic-launcher" data-mck-id="jsfiddle2" data-mck-name="JSFiddler 2">Click to CHAT</a> 
<br> 
<a href="#" class="applozic-launcher" data-mck-id="applozic" data-mck-name="Applozic">Chat with Applozic</a> 
<br> 
Applozic Chat and Messaging SDK to bring real time chat to your mobile apps and websites in just few lines of code. 
<br> 
Visit <a href="https://www.applozic.com">Applozic</a> to know more. 

よりサンプルコードで入手できます。 :https://github.com/AppLozic/Applozic-Web-Plugin/

免責事項:私はCofounder @Applozicです

関連する問題