노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


 

XMPP Server용 XMPP Client 만들기


 

Openfire의 하위 프로젝트인 Smack ( Client Library) 를 사용하여, 간단한 프로그램을

빌드 할 수 있다.




 

예를들어 Openfire서버가 설치된 장비의 Stress Test용도의 클라이언트가 필요하다면

이럴때 사용하면 좋을 것도 같다.

 

 

Openfire Projects  ( ignite realtime ) : http://www.igniterealtime.org/projects/index.jsp

 

 

Smack 라이브러리를 다운로드 해서 프로젝트에 추가하는 방안도 있지만,

프로젝트 자체를 Maven Project를 생성을 하고 나서, pom.xml에 아래 내용을

채워 주면 자동으로 Library들이 포함되는 방법이 더 좋을 듯 하다.

 

 

	
		
		   org.igniterealtime.smack
		      smack-java7
		      4.1.6
		 
		
		        org.igniterealtime.smack
		        smack-tcp
		        4.1.6
		
		
		        org.igniterealtime.smack
		        smack-im
		        4.1.6
		
		
		        org.igniterealtime.smack
		        smack-extensions
		        4.1.6
		
	  

 

 

package smackMavenClient;

import java.io.IOException;
import java.util.Collection;

import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.chat.Chat;
import org.jivesoftware.smack.chat.ChatManager;
import org.jivesoftware.smack.chat.ChatMessageListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.roster.Roster;
import org.jivesoftware.smack.roster.RosterEntry;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;

public class smClient implements ChatMessageListener  {

	private AbstractXMPPConnection conn2 ;
	
	private static smClient c ;
	
	public void login(String userName, String password ) throws SmackException, IOException, XMPPException {
		
		XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
				  .setUsernameAndPassword(userName, password)
				  .setServiceName("localhost")
				  .setHost("localhost")
				  .setPort(5222)
				  .build();
		
		conn2 = new XMPPTCPConnection(config);
		conn2.connect();
	}
	
	public static void main(String[] args) throws SmackException, IOException, XMPPException {

		c = new smClient();

		c.login("아이디", "비번");
		c.sendMessage("보내고 싶은 메시지", "친구아이디");
		c.getFriends();
		
	}
	
	public void sendMessage(String message, String to) throws NotConnectedException {
	
		ChatManager cm = ChatManager.getInstanceFor(conn2);
		
		Chat newChat = cm.createChat(to);
		newChat.addMessageListener( this);
		newChat.sendMessage(message);
		
	}


	public void getFriends() {
		
		Roster r = Roster.getInstanceFor(conn2);
		
		Collection entries = r.getEntries();
		
		for ( RosterEntry entry : entries ) {
			System.out.println( entry.toString() );
		}
		
		c.disconnect();

	}
	
	
	
	public void disconnect()
	{
		conn2.disconnect();
	}
	


	public void processMessage(Chat chat, Message message) {
		
		if ( message.getType().equals("chat")) {
			System.out.println("Received message: " + message.getBody() );
		}

	}


}

 

 

샘플 예제가 있는 웹페이지

 

 

https://namalfernando.wordpress.com/2015/12/18/write-xmpp-client-using-smack-api/ 

 

 

 

* XMPP client로 공개된 소스들에 대한 비교표

 

https://en.wikipedia.org/wiki/Comparison_of_XMPP_clients

 

 

designation Operating system File transfer (XEP-0096) Jingle MUC GPG
ChatSecure Android / Apple iOS Yes per Plugin Yes No
Conversations Android Yes Yes Yes Yes
CoyIM Mac OS X, Linux,Windows
Coccinella Cross-platform Yes Yes Yes No
Gajim BSD/Linux/Windows Yes Yes Yes Yes[Note 1]
Jeti/2 Cross-platform(Java) Yes Voice Beta Yes Yes
Jitsi Cross-platform(Java) Yes Yes Yes No
MCabber Linux, Mac OS X,BSD No No Yes Yes
Pidgin Mac OS X, Linux,Windows Yes Yes Yes per Plugin
Psi eCS/Linux/Mac OS X/Solaris/Windows Yes Yes Yes Yes
Tkabber Cross-platform Yes No Yes Yes

  1. Jump up^ since Version 0.15 on Windows

 

 

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

 

(1) 소개 - Openfire ( 메신저 서버 ) ?




이것은, 그룹웨어처럼 보유한 회원 정보로 연동되는 메신저를 만들수 있다.

 

1) 기존 회원을 보유한 경우 - 해당 정보를 사용하거나 활용

2) 기본적으로 데스크탑 메신저를 제공

3) 모바일용 메신저를 위한 라이브러리 제공 ( 공개된 오픈 소스 클라이언트를 바로 사용 )

 

4) 전용화(rebrand)를 한다면 필요한 것들은 ...

(1) 클라이언트 rebrand (Naming변경 및 이에 따른 Design 변경 적용)

(2) 오픈형 가입(signup)은 block, 전용 가입 창구 마련

(3) 오픈형 클라이언트의 접근을 제한하기 위한 packet변경

(4) 변경된 Packet과 다르면 차단하는 Filter 모듈 제작

 

 


Openfire란

 



 

크로스 플랫폼(또는 멀티 플래폼)을 지원하며, 실시간으로 협업(RTC)을 하도록 도와주는 서버로, 오픈 소스 아파치 라이센스를 따른다.

 

- 제공 platform : Mac OS X, Windows , Redhat / CentOS, Debian /Ubuntu

 

인스턴스 메시징을 위해서 오픈 프로토콜로 예전에 Jabber라고 부르던 XMPP를 사용하며,

설치와 관리가 쉽고, 견고한 보안과 성능을 제공한다.

 

- 커뮤니티 사이트 ignite realtime : Jive Software의 오픈 소스 실시간 커뮤니케이션 프로젝트의 사용자와 개발자를 위한 사이트



http://www.igniterealtime.org/projects/openfire/index.jsp



 

 

추가 프로젝트

 

 

완성된 데스크톱용 Client로 제공되는 Spark 프로젝트(Java)

직접 Client를 제작할떄 필요한 Java Client Library로 제공되는 Smack프로젝트가 있다.

 

 

관련 프로젝트

 

Tinder : 자바 XMPP 라이브러리, XMPP stanza와 component를 구현하도록 제공

Whack : 쉽게 사용 가능한 자바 XMPP 콤포넌트 라이브러리

 

중단 프로젝트

 

XIFF : Flash XMPP client library

SparkWeb : Web based real-time collaboration client

 


http://www.igniterealtime.org/projects/index.jsp





 

실행화면

 

1. 관리자 콘솔

 

2. 클라이언트 실행 화면

 

 

 

 

 

2. 설치본 설치 가이드 / Installation

 

 

Windows , 윈도우


 

Run the Openfire installer. The application will be installed to C:\Program Files\Openfire by default.


오픈파이어 인스톨러를 실행한다. 어플리케이션은 기본적으로 C:\Program Files\Openfire에

에 설치가 된다.

 

Note: If you are installing Openfire on Windows Vista/Windows 7/Windows Server 2008 or newer Windows version and you have UAC protection enabled, then we suggest to choose other installation folder than Program files (e.g. C:\Openfire).

Otherwise you will have to run Openfire launcher with Run as administrator option, because Openfire is storing its configuration (and the embedded database if used) in the installation folder and UAC protection will cause errors on startup, when running without elevated privileges.

 



Linux/Unix , 리눅스/유닉스



Choose either the RPM or tar.gz build. 


RPM 또는 tar.gz 설치본중에서 선택하라.



If using the RPM, run it using your package manager to install Openfire to /opt/openfire:


    rpm -ivh openfire_X_Y_Z.rpm



If using the .tar.gz, extract the archive to /opt or /usr/bin:


    tar -xzvf openfire_X_Y_Z.tar.gz

    mv openfire /opt

 

Note: the .tar.gz build does not contain a bundled Java runtime (JRE). Therefore, you must have JDK or JRE 1.7.0 or later installed on your system. You can check your java version by typing "java -version" at the command line and (if necessary) upgrade your Java installation by visiting java.com.

 


> Running Openfire in Linux/Unix, - RPM


If you are running on a Red Hat or Red Hat like system (CentOS, Fedora, etc), we recommend using the RPM as it contains some custom handling of the standard Red Hat like environment. Assuming that you have used the RPM, you can start and stop Openfire using the /etc/init.d/openfire script.


# /etc/init.d/openfire


Usage /etc/init.d/openfire {start|stop|restart|status|condrestart|reload}


# /etc/init.d/openfire start



> Starting openfire: - .tar.gz 


If you are running on a different Linux/Unix varient, and/or you have used the .tar.gz 'installer', you can start and stop Openfire using the bin/openfire script in your Openfire installation:


# ./openfire
Usage: ./openfire {start|stop}

# ./openfire start
Starting openfire

 

 

설치 가이드

http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/install-guide.html

 

 


* 구축사례 :


소개 : 농협 정보 시스템 / 공개 SW로 사내 메신저 개발

 

 

 

 

http://www.oss.kr/oss_repository10/535682 





* 기타 설정 설명 자료


: openfire 설치본을 설치후에 관리자 콘솔 설정 내용

 

https://www.javacodegeeks.com/2010/08/openfire-server-installation.html

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,