Hi everybody, On ActivityPub (AP) there is currently a thread discussing polls: https://mastodon.social/@Lautaro_Ferrero/115625081357268012 (it switches to English after few messages), and I think that it's good to bring that to standard@ to discuss that mater. We can probably all agree that a poll specification would be a good addition to XMPP, but it's not as trivial as it may first appear to do it well. In my opinion we have the following requirements: - Must work in group chat, notably in MUC including anonymous room and with e2e encryption - Must be flexible enough to enable gateways to poll on other protocols. I notably intend to make a compatibility layer with ActivityPub in the gateway I'm working on - Must be used for many use cases, from voting for lunch location, selecting a date for an event, to various opinion polls (or to vote on XMPP membership ;) ) - Must support constraints: one vote per JID, vote on single or multi items, vote public or hidden, result showed in real-time or only after the end of the poll, etc. I've been thinking about polls for a while, and my idea was to use a combination of data form with XEP-0346 (Form Discovery and Publishing) for public polls and ad-hoc service for complicated constraints. On AP, Larma raise the very valid concern that we can't use IQ with anonymous MUC, which exclude ad-hoc or pubsub. He suggested a direct message approach. We probably need an hybrid approach, with 2 to 3 variant: - direct message approach, necessary for anonymous MUC - pubsub based one, probably using XEP-0346, having a service has many advantages, and pubsub is already present in most servers. - maybe an ad-hoc approach for complex use cases, something based on XEP-0050 (Ad-Hoc Commands) seems adapted. John Livingston has already work on this on Prosody for Peertube, using a dedicated <x-poll> element, you can check it at: https://livingston.frama.io/peertube-plugin-livechat/technical/polls/ index.html I'm volunteering to write a protoXEP for that, with John Livingston if he's OK with that, and anybody else interested. I'm looking forward for your though on the mater. This can also be discussed at the summit next month. Best, Goffi
I have also been thinking about implementing polls for some time. For polls in the context of a chat (1:1 or MUC) this is my proposal: XEP-0004 says the following:
The <x/> element qualified by the 'jabber:x:data' namespace SHOULD be included either directly as a first-level child of a <message/> stanza or ...
The full context for the data is provided by three things ... the place of the form within ... structured conversation (e.g., a message <thread/>)
For <message/> stanzas, the <thread/> SHOULD be copied in the reply if provided. The <x/> element qualified by the 'jabber:x:data' namespace MUST be a child of the <message/> stanza.
This gives us a very natural poll transport mechanism, as follows: <message id="poll1" type="groupchat" from="romeo"> <x xmlns="jabber:x:data" type="form"> <field var="FORM_TYPE" type="hidden"><value>urn:...polls</value></field> <field var="q" label="A or B?" type="list-single"> <option><value>A</value></option> <option><value>B</value></option> </field> </x> <thread>poll-uuid</thread> </message> <message id="pollresponse1" type="groupchat" from="juliet"> <x xmlns="jabber:x:data" type="submit"> <field var="FORM_TYPE" type="hidden"><value>urn:...polls</value></field> <field var="q" label="A or B?" type="list-single"> <value>A</value> </field> </x> <thread>poll-uuid</thread> </message>
Hi Singpolyma, Yeah, I imagine the <message> based solution similar to that too. I'm curious of the use case of polls in 1:1 chat, do you one? Le lundi 1 décembre 2025, 15:49:22 heure normale d’Europe centrale Stephen Paul Weber a écrit :
I have also been thinking about implementing polls for some time. For polls in the context of a chat (1:1 or MUC) this is my proposal:
XEP-0004 says the following:
The <x/> element qualified by the 'jabber:x:data' namespace SHOULD be included either directly as a first-level child of a <message/> stanza or ...
The full context for the data is provided by three things ... the place of the form within ... structured conversation (e.g., a message <thread/>)
For <message/> stanzas, the <thread/> SHOULD be copied in the reply if provided. The <x/> element qualified by the 'jabber:x:data' namespace MUST be a child of the <message/> stanza.
This gives us a very natural poll transport mechanism, as follows:
<message id="poll1" type="groupchat" from="romeo"> <x xmlns="jabber:x:data" type="form"> <field var="FORM_TYPE" type="hidden"><value>urn:...polls</value></field> <field var="q" label="A or B?" type="list-single"> <option><value>A</value></option> <option><value>B</value></option> </field> </x> <thread>poll-uuid</thread> </message>
<message id="pollresponse1" type="groupchat" from="juliet"> <x xmlns="jabber:x:data" type="submit"> <field var="FORM_TYPE" type="hidden"><value>urn:...polls</value></field> <field var="q" label="A or B?" type="list-single"> <value>A</value> </field> </x> <thread>poll-uuid</thread> </message>
participants (2)
-
Goffi -
Stephen Paul Weber