Not logged in. · Lost password · Register
Forum: MatriX RSS
the best way to detect client support
Avatar
tambunanw #1
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Detecting Video/Audio support for Client entities
Hi Alex,

I want to implement the video/audio chat with Jingle. I want to show in my roster list the client who has the audio/video capabilities.

Previously i've already read that that can be done with Service Discovery.

Could you please provide the direction how to do that with DiscoManager ? Do i have to implement the conversation manually ?

Or is there's another way to do that efficiently ?
Avatar
tambunanw #2
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
I've done some research and finally found this one. I think i have to use Entity Capabilities combines with Service Discovery. From the specs i've learnt that i have to do some step to achieve that.

My questions are :

1. do i have to code capabilities request and and build response manually? and register all the namespace and extensions ?
2. how to access all namespace registered in xmpp client ? is that possible with MatriX ?

Thanks before.
Avatar
Alex #3
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes, Service Discovery (Disco) is the correct extensions for asking other clients which features they support.

Normally in all XEPs you can find the registered feature values.
http://xmpp.org/extensions/xep-0166.html#support

An overview over all Disco Features can be found here in the registrar:
http://xmpp.org/registrar/disco-features.html

Many of the XMPP namespaces are in the Uri class of MatriX.

Of course you can also add your own features when you want, because XMPP is an extensible protocol.

To find all features of another client you use DiscoManager.DiscoverInformation. The other client should get the OnDiscoInfoRequest event and respond with all supported features.

Entity Capabilities (Caps) is used to reduce network traffic. Caps are distributed with your presence. In the Caps there is a Hash of all features a client support. You can build this Hash with Caps.BuildHash.
So the assumption is that all your distributed Clients of version 1.0 will exactly send the Disco features. So its enough to Disco 1 client only, because all other clients with the same Caps hash will send exactly the same features in their disco response.
If you have a new feature in v1.1 of your client this results in a different hash, then your clients requests once the features for this new hash and cache them. This technology of course works also when you client is configurable and you can turn features on an off. So client v1.1 with feature B turned off will have another hash than client v1.1 with feature B turned on.

You get the best results and lowest network traffic when you cache the Disco results with the corresponding hash across sessions.

We have not much feedback yet from The DiscoManager an Caps room our customers yet. So any feedback is appreciated. We are also happy to extend the MatriX API when this makes it easier for you.

Alex
Avatar
tambunanw #4
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
To find all features of another client you use DiscoManager.DiscoverInformation. The other client should get the OnDiscoInfoRequest event and respond with all supported features.

So i guess i have to code in OnDiscoInfoRequest and implement how to return the responds by myself ? there's no automatic way to do that ?

I've already looked at Uri class. So i have to add all the feature and do the step by step and build the hash from there?
Avatar
Alex #5
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by tambunanw:
So i guess i have to code in OnDiscoInfoRequest and implement how to return the responds by myself ? there's no automatic way to do that ?

I've already looked at Uri class. So i have to add all the feature and do the step by step and build the hash from there?

currently yes. agsXMPP has features to automate this, and some users were not very happy with that. This is why we are still looking to make this better an easier in MatriX. So all feedback on this topic is welcome.

This is an example for building the response:
  1. var dIq = new DiscoInfoIq();
  2. dIq.Type = IqType.result;
  3. dIq.To = "user@server.com/resource";
  4. dIq.Id = "id_from_request";
  5. dIq.Info.AddFeature(new Feature(Matrix.Uri.DISCO_INFO));
  6. dIq.Info.AddFeature(new Feature("urn:xmpp:jingle:1"));
  7. dIq.Info.AddFeature(new Feature("urn:xmpp:jingle:apps:rtp:audio"));
  8. dIq.Info.AddFeature(new Feature("urn:xmpp:jingle:apps:rtp:video"));

This builds the Hash from the DiscoInfo above
  1. var hash = Caps.BuildHash(dIq.Info);

As I said before, I have no problems to extend the DiscoManager to send automatic responses, and automatically include the Caps in the presence.

So maybe something like that would be useful:
  • new property AutoReplyToDiscoInfo
  • new method AddFeature(string feature)
  • new method RemoveFeature(string feature)

Alex
Avatar
tambunanw #6
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Quote by Alex:
As I said before, I have no problems to extend the DiscoManager to send automatic responses, and automatically include the Caps in the presence.

So maybe something like that would be useful:
  • new property AutoReplyToDiscoInfo
  • new method AddFeature(string feature)
  • new method RemoveFeature(string feature)

Alex

That's great. Looking forward to that extension. Thanks for your quick response Alex.

About a presence, currently i have to send the presence manually using xmppConnection.Send() for adding Caps. So there are 2 presence for one user when login. One without Caps (automatically -> from OpenFire?) and one with the Caps, which i sent manually.

Is there any way to for the first presence so it include the Caps ? or I have to send it manually ?
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by tambunanw:
That's great. Looking forward to that extension. Thanks for your quick response Alex.

ok, I put this on my TODO list and try to implement it ASAP.

Quote by tambunanw:
About a presence, currently i have to send the presence manually using xmppConnection.Send() for adding Caps. So there are 2 presence for one user when login. One without Caps (automatically -> from OpenFire?) and one with the Caps, which i sent manually.

Is there any way to for the first presence so it include the Caps ? or I have to send it manually ?

There is an event OnBeforeSendPresence where you can add custom stuff.

Alex
Avatar
tambunanw #8
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Quote by Alex:
ok, I put this on my TODO list and try to implement it ASAP.

Thanks a lot Alex. That's very kind of you.

Quote by Alex:
There is an event OnBeforeSendPresence where you can add custom stuff.

Great. It works. :D
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have uploaded a new build to the latest binaries which has an AutoReply function now and can build the caps hash.
Your feedback is welcome.

Alex
Avatar
tambunanw #10
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Thanks a lot Alex. That's Great.

I will try to use it and give feedback to you
Avatar
tambunanw #11
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Hi Alex,

I've tried the new libs.

I used it like this

  1. discMgr = new DiscoManager(xmppCon);
  2. discMgr.AutoReplyToDiscoInfo = true;

But i've got no automatic reply when request the info if i'm not attach a handler for request event. So i have to create an empty handler for request event and the the replied is created.

  1. discMgr.OnDiscoInfoRequest += new EventHandler<Matrix.Xmpp.Disco.DiscoIqEventArgs>(discMgr_OnDiscoInfoRequest);

And i've noticed that there's no Caps attached in presence yet... Am i doing something wrong here?
Avatar
tambunanw #12
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Btw Alex,

There's a new method which i think contains typos like discMgr.Removeidentity. I think the that should be RemoveIdentity.

Could you please explain when do i use this method ?
Avatar
Alex #13
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have uploaded a new version. The typo is fixed and it also replies now without adding the handler.
There is also a new property AutoSendCaps now. When this is set to true then the DiscoManager automatically adds the Caps to all outgoing presence. When you use this then you also have to set the Node property of the DiscoManager.

Quote by XEP-0115:
The 'node' attribute represents the client software Romeo is using. The 'ver' attribute is a specially-constructed string (called a "verification string") that represents the entity's service discovery identity (category and type as registered at <http://xmpp.org/registrar/disco-categories.html>, as well as, optionally, xml:lang and name) and supported features (as registered at <http://xmpp.org/registrar/disco-features.html> as well as, optionally, extended service discovery information data registered at <http://xmpp.org/registrar/formtypes.html>).

Disco can also include Identities (AddIdentity and RemoveIdentity methods). If yo don't need them you can ignore them.

Quote by XEP-0030:
The target entity's identity. In disco, an entity's identity is broken down into its category (server, client, gateway, directory, etc.) and its particular type within that category (IM server, phone vs. handheld client, MSN gateway vs. AIM gateway, user directory vs. chatroom directory, etc.). This information helps requesting entities to determine the group or "bucket" of services into which the entity is most appropriately placed (e.g., perhaps the entity is shown in a GUI with an appropriate icon). An entity MAY have multiple identities. When multiple identity elements are provided, the name attributes for each identity element SHOULD have the same value.

Please let me know if the latest version is working better for you.

Alex
Avatar
tambunanw #14
User title: Welly
Member since Jul 2011 · 57 posts · Location: Jakarta
Group memberships: Members, Premium
Show profile · Link to this post
Hi Alex,

The latest version is doing great. I love it. Thanks a lot.

Previously you've said that

Quote by Alex on 2011-10-28, 09:47:
An overview over all Disco Features can be found here in the registrar:
http://xmpp.org/registrar/disco-features.html

Many of the XMPP namespaces are in the Uri class of MatriX.

Of course you can also add your own features when you want, because XMPP is an extensible protocol.

Could you provide the way to access all the registered feature and added feature, so we can add it ? Or maybe can it be done automatically without adding manually ?
Avatar
Alex #15
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by tambunanw:
Could you provide the way to access all the registered feature and added feature, so we can add it ? Or maybe can it be done automatically without adding manually ?
You don't need all registered fatures. You need only the feaures your clients supports. When a clients sends features which you don't know you can ignore them. You can find them all in the Uri class. Let me know which features are missing there then we can add them.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS