-4
我有我現有的java web應用程序運行生產(maven java項目)。現在我想在屏幕右下角的應用程序中嵌入聊天。我應該怎麼做呢?有沒有簡單的方法,我可以添加聊天應用程序的示例或API?我的網絡應用程序只能用於登錄用戶,所以我想讓所有登錄到我的應用程序的用戶在1對1或聊天組中聊天。在web應用程序中聊天
我有我現有的java web應用程序運行生產(maven java項目)。現在我想在屏幕右下角的應用程序中嵌入聊天。我應該怎麼做呢?有沒有簡單的方法,我可以添加聊天應用程序的示例或API?我的網絡應用程序只能用於登錄用戶,所以我想讓所有登錄到我的應用程序的用戶在1對1或聊天組中聊天。在web應用程序中聊天
下面是使用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/
聲明:我是聯合創始人@Applozic