ConfigureForm form = new ConfigureForm(FormType.submit);
        form.setPersistentItems(false);
        form.setDeliverPayloads(true);
        form.setAccessModel(AccessModel.open);

 

        PubSubManager manager = new PubSubManager(connection, "pubsub.my.openfire.server");

        Node myNode = manager.createNode("TestNode", form);

 

        SimplePayload payload = new SimplePayload("book","pubsub:test:book", "<book xmlns='pubsub:test:book'><title>Lord of the Rings</title></book>");

        Item<SimplePayload> item = new Item<SimplePayload>(itemId, payload);

 

        // Required to recieve the events being published

        myNode.addItemEventListener(myEventHandler);

 

        // Publish item

        myNode.publish(item);

 

 

 

Get node and listen (different user)

 

        Node eventNode = manager.getNode("TestNode");

        eventNode.addItemEventListener(myEventHandler);

        eventNode.subscribe("myJID");

'Android > xmpp' 카테고리의 다른 글

XMPP 프로토콜 이름 정리  (0) 2017.01.26
openfire ssl 설정방법  (0) 2017.01.23
XMPP 예제 소스  (0) 2017.01.22
XMPP 그룹 채팅 흐름도..  (0) 2017.01.17
Xmpp 으로 할수 있는 내용 정리  (0) 2017.01.17

+ Recent posts