iNPUTmice / Conversations

Conversations is an open source XMPP/Jabber client for Android

Home Page:https://conversations.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Choosing a proper message to send information about facial emotion

VojtaMaiwald opened this issue · comments

Hello,

I have dived into XMPP protocol just recently I am really not sure what are the best practices. So I would like to kindly ask you for a help.

Use case:

I have a neural network for facial emotions classification and I want to enhance this chat app with it. My idea is to let chat participants share their real emotions (if they are happy, angry, sad, neutral, surprised, ...) in 1v1 chat room. I was thinking about some small animated emoji. To achieve this I need to send emotion id between clients periodically (lets say once per 1 second), no response is required.

My testings:

My first approach was to add attribute to XEP-0199 ping message like so:

<iq from='romeo@montague.lit/home' to='juliet@capulet.lit/chamber' type='get' id='e2e1'>
    <ping xmlns='urn:xmpp:ping' emotionId='0'/>
</iq>

Problem is that <iq> wrapper of ping needs to have a full JID (with resource part) as to attribute, otherwise ping is resolved by server and not the client and I am not really sure how to get full JID of a chat member. Method getJid() called on an Account class instance does not do the job and the JID resource part has to be added manually.

My second idea was sending <presence> message with modified status child tag like so:

<presence from='romeo@example.net/orchard' xml:lang='en'>
   <status emotionId='0'/>
</presence>

Questions:

Is it a good approach to add attributes to existing tags? Should I define my own child tags in presence message and handle them? Do you guys have any tips what may be better way to achieve this?

Thank you for any answers in advance.

Is it a good approach to add attributes to existing tags?

No

Should I define my own child tags in presence message and handle them?

Sounds like a better idea than the IQ/ping approach or the one with custom attributes.

If you want to extend the protocol you are probably better of asking those questions in the jdev channel as those are not specific to Conversations.