首頁

2013年9月15日 星期日

**遇網友疑問*使用>> XMPP,ejabberd使測試但~我的所有帳號都不能使用的解決方法~!*

**遇網友疑問*使用>> XMPP,ejabberd使測試但~ 
我的所有帳號都不能使用的解決方法~!*
US** Use case netizens doubt ** >> XMPP, ejabberd the test but ---
 --- I can not use all the accounts are workarounds ~! *

**使用XMPP 構建一個基於web 的通知工具
使用XMPP、PHP和JavaScript編寫實時web應用程序

--------------------------------------------------------------------------------------
簡介:實時web應用程序是聯網的應用程序,帶有基於web的用戶界面,能夠及時顯示剛剛發布的Internet信息。
這樣的應用程序示例包括社會新聞聚合器和監控工具,它們能夠使用來自外部源的數據持續更新。
在本教程中,您將創建一個小型通知工具Pingstream,它使用PHP 和JavaScript 通過Extensible Messaging and ---
---Presence Protocol (XMPP) 進行通信,XMPP 是一組設計用於支持聯機狀態和實時通信功能的XML 技術 .
XMPP簡介
本小節將簡要介紹XMPP,它的起源,以及為何它是一個適合實時web 通信的協議。
您將檢查XMPP 通信設置的組件,並查看展示這些組件如何使用的示例。
獲取和安裝一個XMPP服務器
在本小節中,您將安裝Openfire XMPP 服務器並配置它來支持您的實時web 應用程序。
選擇一個XMPP服務器

有兩個領先的開源XMPP 服務器可以免費下載。
它們都應用廣泛並通過GNU Public License version 2 許可,每個服務器都有自己的優勢和缺點:
ejabberd:ejabberd中的e指的是Erlang,一種軟實時編程語言。 這一技術基石使ejabberd 非常快。
它還與XMPP 核心和相關標準高度兼容。  ejabberd 可以安裝在大多數環境中。
Openfire:Openfire 用Java™ 語言編寫,用戶友好,安裝方便。
本教程使用Openfire。

--------------------------------------------------------------------------------
創建Openfire數據庫
為您的Openfire 用戶和配置創建一個新的MySQL 數據庫。
通過使用MySQL,您可以以編程方式從您的PHP web 應用程序添加、編輯、
刪除和查詢您的XMPP 服務器用戶,以及調節您的XMPP 基礎設施以匹配您的web 基礎設施。

如果您安裝了phpMyAdmin,比如作為您的XAMPP 安裝的一部分,

那麼您可以按照以下步驟創建數據庫:

1.從主界面選擇Privileges 。
2.選擇Add a new user 。
3.添加用戶細節(確保主機是localhost;

本教程假定您是在localhost上測試),
選擇Create database with same name and grant all privileges ,
如圖1所示。 不要向您的Openfire 數據庫新用戶授予全局數據庫特權 !
圖1.在phpMyAdmin中添加一個Openfire數據庫 .

添加用戶和數據庫後,就可以安裝Openfire 服務器了 .
安裝Openfire
下載Openfire安裝程序並運行它,將Openfire安裝到您選擇的位置(參見參考資料 )。
(您也可以選擇從Openfire 的Subversion 源代碼知識庫檢查Openfire 的---

---最新版本並本地構建它,但這個主題超出了本教程的範圍。)
收到提示時,告知Openfire 安裝程序在安裝完成時啟動服務器。
服務器啟動後,您應該看到服務器狀態窗口,如圖2所示:
圖2. Openfire的狀態窗口 .

單擊Launch Admin打開一個基於web的嚮導,如圖3所示,

該嚮導將帶您逐步配置您的Openfire服務器:
圖3.配置嚮導 .

配置嚮導允許您選擇使用標準數據庫連接或嵌入式數據庫連接。
選擇標準數據庫連接,以便您能夠使用您的MySQL 數據庫。

從Database Driver Presets列表選擇MySQL。

 將您的服務器和數據庫名稱插入Database URL字段。
例如,對於在localhost 上設置、名為openfire 的MySQL 數據庫而言,應輸入:
        jdbc:mysql://localhost:3306/openfire

在嚮導的下一屏幕上,選擇將用戶帳戶存儲在數據庫中。
輸入此前創建的數據庫用戶的用戶名和密碼,然後一直繼續到配置嚮導結束。
此時,您應該已經為您的XMPP 服務器創建了一個服務器管理員並設置了域位置  !
使用您建立的管理員憑證登錄到管理屏幕。
單擊Edit Properties (位於Server ports下方),記錄列示的服務器名稱。
這個名稱將形成您的JIDs 的域部分。
這個名稱是不可互換的,比如,不能使用localhost替代127.0.0.1 ,反之也不行。

單擊頂部導航菜單中的Users/Groups並創建兩個新用戶。
這些用戶將您在開發過程中的測試用戶。
單擊Server settings ,然後單擊Offline messages 。 由於您將XMPP用於界面通知,
因此應將Offline Message Policy設置為Drop ,如圖4所示。
您不想保存用戶沒有登錄時收到的消息,否則,
當他們返回時,可能會被數千條通知所“淹沒”。
每用戶通知的插件 根據本教程的演示目的,您將只需使用在這裡創建的兩個用戶。
但是,如果您希望在您的應用程序中支持複雜的每用戶通知,
那麼您需要能夠以編程方式從您的應用程序的PHP 部分添加和移除用戶。
Openfire 的User Service 插件通過一個用於XMPP 

用戶管理的REST 界面向您提供這個功能。
要安裝這個插件,從Openfire插件站點(參見參考資料 )下載它。
插件本身是單個文件:userservice.jar。

您必須將其放置到您的Openfire 安裝的/plu​​gins 目錄中  .
[url=XMPP Standards Foundation ]訪問XMPP官方站點[/url]
探索XMPP的細節,了解如何將它用於簡單消息傳遞
實現可擴展消息傳遞和到場協議(XMPP) .
使用XMPP、SMS、pureXML和PHP創建警報系統  .

了解如何使用Ajax輪詢實現一個實時web應用程序
了解如何使用這個web腳本語言
進一步了解這個用Erlang語言編寫的XMPP服務器
個性化您的developerWorks體驗

圖4.丟棄離線消息

在Server settings中,單擊Server to Server 。
對於本文,您不必連接到外部服務器,因為您不需要作為更大的XMPP 網絡的

一個連接部分操作。
因此,將Service Enabled設置為Disabled , Allowed to Connect設置為White List 。
這些設置將阻止未授權的連接造成破壞
配置Apache以通過BOSH轉發XMPP

Openfire 在http://localhost:7070/http-bind 維護了一個HTTP 綁定URL,

以便通過BOSH 訪問。
要在端口80 上使用這個URL,您必須配置Apache HTTP Server 以

將一個URL 轉發到這個位置。
為此,您需要啟動代理模塊。

打開您的http.conf Apache配置文件並找到mod_proxy.so和mod_proxy_http.so的

LoadModule條目,它們默認被註釋掉。
移除前導的井字符( # ),取消註釋。
這個配置文件的Dynamic Shared Object (DSO) Support部分中的多個適當的行

(不一定在一起)現在應該類似於清單8 :
清單8.啟用Apache HTTP Server中的代理支持

安裝過程
Archipel的其中一個最大缺點體現在安裝過程:說明文檔內容極其匱乏。
但至少,描述設置的部分相當清晰,不過你需要留意幾個錯誤。
最好的辦法就是從安裝Ejabberd入手,它需要版本至少是2.1.6,

最好使用二進制安裝工具。
接下來,你需要添加ejabberd_xmlrpc和mod_admin_extra模塊,

以擴展XMPP服務器。
為此,獲取用Erlang編寫的源代碼,然後將因而獲得的*.beam文件拷貝---

---到Ejabberd後台駐留程序的ebin目錄(代碼段1和代碼段2)。

完成了這一步後,你需要修改/opt/ejabberd?2.1.6/conf/ejabberd.cfg

(視發行版而定,這個文件可能是/etc /ejabberd/ejabberd.cfg)。
為此,啟用你剛剛創建的模塊;最重要的是,輸入完全符合標準的域名(FQDN)。
遺憾的是,Archipel項目記載的配置方法在許多方面具有誤導性;

為此,你可能應該遵循代碼段3。

代碼段1:ejabberd_xmlrpc

wget
http://www.ejabberd.im/files/contributions/

xmlrpc?1.13?ipr2.tgz

tar ?xzvf xmlrpc?1.13?ipr2.tgz

cd xmlrpc?1.13/src

make

cd ../../

cp ebin/*.beam /opt/ejabberd?2.1.6/lib/ejabberd?2.1.6/ebin

最後,創建管理員帳戶,完成Ejabberd的設置:

eejabberdctl register admin FQDN password

設置Archipel代理的過程要快一點,從依賴性檢查開始,

為此你需要Python版本2.5或更新版本、
Libvirt版本0.8.7或更新版本、KVM等虛擬機管理程序,

以及Qemu版本0.12.5或更新版本。
此外,你應該有Qemu-img和Python設置工具。

代碼段2:mod_admin_extra

cd /usr/local/src/ejabberd?modules/mod_admin_extra/trunk/

./build.sh

cp ebin/mod_admin_extra.beam

/opt/ejabberd?2.1.6/lib/ejabberd?2.1.6/ebin

代碼段3:ejabberd.cfg

01 {hosts, ["jabber.deutschewolke.datenwerk?it.de"]}.

02 [...]

03 {listen,

04 [

05 {4560, ejabberd_xmlrpc, []},

[ 06 {5280, ejabberd_http, [

07 http_bind,

08 http_poll,

09 web_admin

10 ]}

11 ]}.

12 [...]

13 {modules,

14 [

15 {mod_adhoc, []},

16 {mod_http_bind,[]},

17 [...]

18 {mod_admin_extra, []}

19 ]}.

20 [...]

下面序列的命令安裝了Archipel代理:

easy_install archipel?agent

archipel?initinstall

現在,你需要把服務器的FQDN添加到/etc/archipel/archipel.conf,

使用提供的init腳本來啟動Archipel:

             /etc/init.d/archipel start

最後,你需要兩個Ejabberd pubsub節點,確保權限系統和標記管理可以正常工作:

archipel?tagnode ??jid=admin@FQDN ??password=Password ??create

SUCCESS: pubsub node /archipel/tags created!

archipel?rolesnode ?jid=admin@FQDN ??password=Password ??create

SUCCESS: pubsub node /archipel/roles created!

你不需要手动建立客户端,在Archipel维基中已有详细描述。
而是只要选择最新的Archipel客户端发行版,将它解压缩到本地目录中,

在浏览器中打开index.html。
至於登錄時,輸入完全符合標準的Jabber ID很重要;也就是說,

該ID必須包括完整的服務器名稱(圖)。

就客戶端的Archipel登錄而言,你需要在Jabber ID字段中

輸入完整的登錄名(包括域)。
你在這裡所需的密碼是你在創建管理員帳戶時指定的登錄信息。
Service BOSH字段的URL遵循http://FQDN:5280/http?bind這種模式  !!


XMPP,ejabberd使測試但~我的所有帳號都不能使用的解決方法-
-希望以上的能幫到你吧~完結~*******

***Using XMPP to build a web-based notification toolUsing XMPP,  
 PHP and JavaScript live web application-
------------------------------------------------- ------------------------------------
Description : Real-time web applications are networked applications ,
with web-based user interface ,
the ability to display the just-released Internet Information .
Examples of such applications include social news 
aggregators and monitoring tools ,
they are able to use data from an external source continuously updated .
In this tutorial , you will create a small notification tool Pingstream,

which uses PHP and JavaScript through the Extensible Messaging and ---
--- Presence Protocol (XMPP) for communication , XMPP is a group
designed to support online and real-time communication
capabilities XML technologies.XMPP IntroductionThis section will briefly describe XMPP,
 its origins , and why it is a communication protocol for real-time web .
You will examine the components of XMPP communication settings and

view showing an example of how to use these components .
Obtaining and installing an XMPP serverIn this section,
you will install Openfire XMPP server and configure it to
support your real-time web applications.Select an XMPP serverThere are two leading open source XMPP server can be downloaded for free.
They are widely used by GNU Public License version 2 license ,
each server has its own advantages and disadvantages:ejabberd: ejabberd in e refers Erlang, a soft real-time programming language.
 This technology foundation that ejabberd very quickly.It also works with XMPP core and related standards are highly compatible .

ejabberd can be installed in most environments .Openfire: Openfire in the Java ™ language, user-friendly , easy to install.This tutorial uses Openfire.-------------------------------------------------- ------------------------------Create Openfire databaseOpenfire for your user and configuration to create a new MySQL database.By using MySQL, you can programmatically from your PHP web application to add ,
edit,Delete, and query your XMPP server users, and adjust your XMPP infrastructure
to match your web infrastructure.If you install phpMyAdmin, for example as part of your XAMPP installation ,
 you can follow these steps to create the database :1 From the main interface, select Privileges.2 Select Add a new user.3 Add user details ( make sure the host is localhost;
 This tutorial assumes that you are testing on localhost ) ,
select Create database with same name and grant all privileges,
shown in Figure 1 . Do your Openfire database to a new global database ---
---user is granted privileges !Figure 1 in phpMyAdmin add an Openfire database . 
After adding users and databases , you can install Openfire server.Installing OpenfireDownload Openfire installer and run it, install the Openfire 
 location of your choice ( see Resources ) .
( You can also choose from a Subversion source code repository --
--Openfire Openfire check the latest version and build it locally ,
but this topic is beyond the scope of this tutorial . ) When prompted, 
 inform Openfire installation program starts the server when --
--the installation is complete .Server starts,
you should see the server status window ,
shown in Figure 2 :Figure 2. Openfire status window .
 
Click the Launch Admin to open a web-based wizard ,

 shown in Figure 3 , the wizard will take you step by step to --
--configure your Openfire server :Figure 3 Configuration Wizard. 
Configuration Wizard allows you to choose to use the standard
 database connection or an embedded database connection.
Select the standard database connection , so you can use your MySQL database. 
From the Database Driver Presets list, select MySQL.
Your server and database name into the Database URL field .  
For example, set up on localhost called openfire MySQL
database , it should enter:
        
jdbc: mysql :/ / localhost: 3306/openfireOn the next screen of the wizard ,  

select the user accounts are stored in the database.
Enter the previously created database user name and password,
and then continues until the end of the configuration wizard .
At this point, you should have for your XMPP server creates a server
administrator and set up the domain location ! 
Use your administrator credentials to log on to establish management screen .
Click the Edit Properties ( Server ports located below ) , 
record lists the server name .This name will form part of your domain JIDs .
This name is not interchangeable ,
for example, can not use 
localhost replace 127.0.0.1, nor vice versa .  
Click on the top navigation menu Users / Groups and create two new users.
These users will develop during your test user .
Click Server settings, and then click Offline messages.
Because you will XMPP interface for notifications, 
Offline Message Policy should therefore be set to Drop, shown in Figure 4 . 
You do not want to save the user is not logged when the received message , 
otherwise ,When they return , they may be thousands of notifications "drowned .
"Each user notification plugin demonstration purposes of this tutorial , 
 you will only need to use two users created here .However, 
if you want your application to support complex per user notification ,
Then you need to be able to programmatically from your application's PHP 
 section to add and remove users.  
Openfire 's User Service plugin via an XMPP user management for
the REST interface to provide you with this function  .
To install this plugin, plugin from Openfire site ( see Resources ) to download it. 
Plug-in itself is a single file : userservice.jar. You must be placed into your
Openfire installation / plu gins directory.  
[url = XMPP Standards Foundation] Visit XMPP official site  
[/ url] XMPP explore the details of how to use it for simple messagingScalable 
messaging and presence protocol (XMPP). 

Using XMPP, SMS, pureXML and PHP to create alarm systems.
Learn how to use Ajax polling to achieve a real-time web application Learn  
 how to use this web scripting language Learn more about this use XMPP server
written in Erlang Personalize your developerWorks experience  Figure 4.
 Discard offline messages  In the Server settings ,
 click Server to Server.For this article,   
you do not need to connect to an external server ,
 because you do not need a larger XMPP network as a connection part
of the operation . 
Therefore, the Service Enabled is set to Disabled, 
Allowed to Connect is set to White List.
These settings will prevent unauthorized connections damageConfigure Apache 
to forward XMPP over BOSH Openfire in --
http://localhost:7070/http-bind maintains an HTTP binding URL, 
 in order to adopt BOSH access . 
To use this on port 80 URL, you must configure the Apache HTTP Server to 
a URL forwarding to this location. 
To do this , you need to start the proxy module . 
Open your http.conf Apache configuration file and locate mod_proxy. 
so and mod_proxy_http.so the LoadModule entries that are commented out by default . 
Remove the preamble pound sign (# ) , uncommented .
This configuration file is Dynamic Shared Object (DSO) Support section in 
the appropriate row ( not necessarily together ) should now look like Listing 8:Listing 8. Enable Apache HTTP Server The proxy support Installation processOne of the biggest drawbacks Archipel reflected in the installation process:
documentation content is extremely scarce.
But at least some fairly clear description of setting ,  
 but you need to pay attention to several errors .
The best way is to start from the installation Ejabberd ,
it requires at least version 2.1.6 , it is best to use a binary installation tool. 
Next, you need to add ejabberd_xmlrpc and mod_admin_extra modules to ---
---extend XMPP server . 
Therefore , access to the source code written in Erlang , and then thus obtained *.  
 Beam files are copied to Ejabberd daemon ebin directory
( code 1 and code 2 ) .After completion of this step , you need to modify the / opt / ejabberd? 2.1.6/conf/ejabberd.cfg ( depending on release may be, this file may be / 
 etc / ejabberd / ejabberd.cfg).To do this , enable the module you just created ;
most importantly,
enter the fully qualified domain name of the standard (FQDN). 
Unfortunately , Archipel project configuration method described ---
---in many ways misleading ;  
 For this reason, you should probably follow the code segment 3 .Code segment 1:

 ejabberd_xmlrpcwget http://www.ejabberd.im/files/contributions/xmlrpc? 1.13? ipr2.tgztar? xzvf xmlrpc? 1.13? ipr2.tgzcd xmlrpc? 1.13/srcmakecd .. / .. /cp ebin / *. beam / opt / ejabberd? 2.1.6/lib/ejabberd? 2.1.6/ebinFinally, create an administrator account , complete Ejabberd settings:eejabberdctl register admin FQDN passwordSet Archipel agent process should be a little faster,
start from the dependency check , for which you need Python version 2.5 or later,Libvirt version 0.8.7 or later , KVM hypervisor , etc. ,
as well as Qemu version 0.12.5 or later.
In addition, you should have Qemu-img and Python setup tools .
Code segment 2: mod_admin_extracd / usr / local / src / ejabberd? modules / mod_admin_extra / trunk /. / build.shcp ebin / mod_admin_extra.beam/ opt / ejabberd? 2.1.6/lib/ejabberd? 2.1.6/ebinCode segment 
3: ejabberd.cfg01 {hosts, ["jabber.deutschewolke.datenwerk? It.de"]}.
02 [ ... ]
03 {listen,
04 [
05 {4560, ejabberd_xmlrpc, []},[
06 {5280, ejabberd_http, [
07 http_bind,
08 http_poll,
09 web_admin
10 ] }
11 ] } .
12 [ ... ]
13 {modules,
14 [
15 {mod_adhoc, []},
16 {mod_http_bind, []},
17 [ ... ]
18 {mod_admin_extra, []}
19 ] } .
20 [ ... ]
The following sequence of commands to install the Archipel Agent:
easy_install archipel? agentarchipel? initinstallNow, 
you need to add the FQDN of the server to / etc / archipel / archipel.conf,
using the provided init script to start Archipel:

             
/ etc / init.d / archipel start   

Finally, you need two Ejabberd pubsub nodes ,
ensure permissions system and label management can work :
archipel? tagnode?? jid = admin @ FQDN?? password = Password?? createSUCCESS: pubsub node / archipel / tags created!archipel? rolesnode? jid = admin @ FQDN?? password = Password?? createSUCCESS: pubsub node / archipel / roles created!
You do not need to manually create a client, are described in detail Archipel wiki . 
Instead, just select the latest release Archipel client , unzip it to a local directory,
 the browser opens index.html.As you log in,  
enter the fully compliant Jabber ID is very important ;
 That is, the ID must include the full name of the server ( Figure ) .Log in to the client's Archipel is concerned, you need to Jabber ID field,
enter the full login name ( including the domain ) . 
**Your password is required here is that you specified when creating an
administrator account login information . 
Service BOSH URL field follow http://FQDN:5280/http?bind this model ! !
*

*XMPP, ejabberd the test but - I can not use all accounts a solution -
---I hope you can help more than the end of it ~~  ***

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7


沒有留言:

張貼留言


if you like make fds, wellcome you here~~anytime***

my free place for everyones who want the good software,

come & download them~ wellcome!!