Android Reallysmall Messagebroker (based on MQTT) __java

Source: Internet
Author: User

Original address: http://blog.sina.com.cn/s/blog_6c762bb30101bkfp.html

First, download RSMBThe full name is Reallysmall Messagebroker. Click the address below to download https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid= d5bedadd-e46f-4c97-af89-22d65ffee070Second, start RSMB service after downloading, unzipThe directory structure is as follows.
It can be seen from the above, because we download is suitable for all the platform download package, so there are linux,mac,windows and other directories. Open the Windows directory with the following file:
Enter broker at the command line window as follows:
This mistake was made by myself. Because I copied the files under Windows to a different directory. Copy the message catalogue again. Enter the Borker in the command window as follows:
As seen from above, RSMB did not start. It turns out that I started the same machine with the Mosquitto, exiting the Mosquitto. Enter the broker command again.
As you can see from the image above, the MQTT is started and the port is 1883.
third, download Ia92Click the address below to download http://www-01.ibm.com/support/docview.wss?uid=swg24006006Four, run the exampleAfter downloading from the above address, unzip the directory structure as follows:
Open the J2SE directory with the following files:
Enter commands at the Command Line window as follows:
Pop up a window the following figure: Repeat the above steps, and then open a similar window, click the Options bar, enter different client Identifier: Two interfaces are clicked on the Connect button
Let's go to the RSMB Command window, which reads as follows:

Indicates that the Client1,client2 are connected to the RSMB service. Then in Client1 I entered the subscribetopic to subscribe to the topic, such as: Test/hello/word, click the Subscribe button. In the client2 inside the publish messages input the same theme, input message content, click Publish.
The results are as follows:
As can be seen from the above picture, CLIENT1 received a message. As a result, we build RSMB and send and receive messages successfully. The above practice has to thank the eldest brother's article. Finally a step-by-step to do the configuration succeeded Ah. Mosquitto did not succeed for half a month. Oh, my God.
v. Android Example
Now we have to try to see if the Android phone can receive the message sent. Or this cow, we will be the code here to copy down the basic can run successfully. The phone can also receive publish news. I have compiled the code myself, as detailed in the next blog post.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.