Creating and Subscribing to an Event Node¶
An event node is a virtual address stored on a server, which can receive data from publishers and send received data to subscribers. Users are free to create and configure their own event nodes. Users can subscribe to event nodes according to their access model and publish data if they are authorized to do so. For more information about event nodes, please refer to XEP:0060: Publish-Subscribe
In the following example we will create an event node with an open access model, meaning that any user can subscribe to the node. We will then subscribe ourselves to the node and check if the subscription was successful.
Create a New Event Node¶
cd mio/tools/cmd-line/c/bin ./mio_node_create -event my_node_address -access open -u firstname.lastname@example.org -p password Request successful
Subscribe to the Node¶
./mio_subscribe -event my_node_address -u email@example.com -p password Request successful
Check if we Are Subscribed to the Node¶
The mio_subscriptions_query tool can list all nodes that a user is subscribed to, or all users subscribed to a particular node. We will have the tool list all of our subscriptions:
./mio_subscriptions_query -u firstname.lastname@example.org -p password MIO Subscriptions Packet: Subscription: my_node_address Sub ID: 58692D8FE607A
The node that we just created should show up in the list as a subscription. Alternately we can also query the subscriptions of the node we created:
./mio_subscriptions_query -event my_node_address -u email@example.com -p password MIO Subscriptions Packet: Subscription: firstname.lastname@example.org Sub ID: 58692D8FE607B
Our username should show up in the list as a subscription.