Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 网络聊天应用_Java_Web Applications_Chat - Fatal编程技术网

Java 网络聊天应用

Java 网络聊天应用,java,web-applications,chat,Java,Web Applications,Chat,我的现有java web应用程序正在运行生产(maven java项目)。现在我想在屏幕右下角的应用程序中嵌入聊天。我该怎么做呢?是否有任何简单的方法、示例或API可以添加聊天应用程序?我的web应用程序只能用于已登录的用户,因此我希望所有已登录我的应用程序的用户都能以1对1或在聊天组中进行聊天。以下是使用聊天库的javascript聊天代码示例: Javascript: (function(d, m){var s, h; s = document.createElement("s

我的现有java web应用程序正在运行生产(maven java项目)。现在我想在屏幕右下角的应用程序中嵌入聊天。我该怎么做呢?是否有任何简单的方法、示例或API可以添加聊天应用程序?我的web应用程序只能用于已登录的用户,因此我希望所有已登录我的应用程序的用户都能以1对1或在聊天组中进行聊天。

以下是使用聊天库的javascript聊天代码示例:

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:

在另一个选项卡中打开此提琴,将userId:“jsfiddle2”放在JavaScriptp部分,将data mck id=“jsfiddle1”放在下面的html超链接中




Applozic Chat and Messaging SDK,只需几行代码即可为您的移动应用程序和网站带来实时聊天功能。
访问了解更多信息。
有关更多示例代码,请访问:

免责声明:我是Applozic的联合创始人

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.