Data forms in XMPP-FTW
As data forms follow a set format, they are easy to map to and from JSON for use with XMPP-FTW
. The only minor difference with data forms is that as we are using named events, XMPP-FTW
is able to fill in the FORM_TYPE
on your behalf; so it's a little simpler again.
If we take the preceding example in which we configured a chat room, we'd have the following in XMPP-FTW
:
socket.send( 'xmpp.muc.room.config.get', { "room": "gang@lous.cafe" }, function(error, data) { console.log(error, data) } )
The server would then respond with a data form formatted, like so:
{ title: "Configuration for "gang" Room", instructions: "Update this form to modify the configuration of the chat room", fields: [ { var: "muc#roomconfig_roomname", type: "text-single", required: false, value: "Biff's gang @ the diner", label: "Room Name" }, { var: "muc#roomconfig_maxusers", type: "list...