Server defined attributes for clients in XMPP - xmpp

Is it possible to assign attributes to clients in XMPP on the server? I mean something like "XEP-0115: Entity Capabilities", but defined by the server, not by the client. I would like to use this to assign groups to users that they cannot change but request for all clients.

Related

How to test a server API (REST) including interactions from multiple users/clients with symfony?

We have a supplier that develops a linux-server for us exposing a REST API. We are developing a client application that uses this REST API. Multiple clients running this client applications work together and e.g. have a chat functionality. I would now like to write tests using the rest-API to verify if the server logic for this chat functionality is working: e.g. "Does client Jane receive the correct message if client Tarzan is sending a message".
I am thinking about something like this (pseudo-code):
client_tarzan = createclient()
client_jane = createclient()
#the actual login logic is hidden to make the example easier
client_tarzan.login_to_server
client_jane.login_to_server
client_tarzan->request('POST‘,hello_message_for_jane)
received_message = client_jane->request('GET‘,inbox_path)
expect(received_message).to be(expected_message)
The server needs the REST API calls from Tarzan and Jane to be coming from different IP addresses as it internally uses the IP addresses in its logic.
Is this possible with synfony?
How would I start to do something like that?
Do I need to do something special when interfacing the linux server (e.g. run it in a VM?) as I cannot imagine how simfony would be able to create actual TCP packages coming from different IP addresses in order to make the server believe that the two clients are actually separate. I guess this is the core of my question.
Symfony's test-client supports faking IP addresses and you can create multiple clients in a test.
The following example should give you an idea how to get started:
$client1 = static::createClient([], ['REMOTE_ADDR' => '11.11.11.11']);
$client2 = static::createClient([], ['REMOTE_ADDR' => '22.22.22.22']);
$client1->request('POST', '/say', ['message' => 'Hi']);
$client2->request('GET', '/chat');
For further guidance please consult the documentation chapter: Working with the Test Client

XMPP protocol allow registration using protocol

I want to write own XMPP client. I have jabber server. Is it real use XMPP library only register on server programaticaly?
I want to generate login, password prog-ly, then register prog-ly on server and start to chat. Or XMPP protocol doesn't allow have registering operation?
Registering an account via the XMPP protocol is known as in-band registration, defined in XEP-0077.
However, not all servers support this, or they have it disabled, or impose time/IP limits, as this makes it easy for people writing spambots (which hopefully you are not doing) to easily create multiple accounts automatically.
Like with most XMPP extensions, you can use Service Discovery to determine whether a server supports in-band registration.

Create the same user on xmpp server when a user is created in a rails 3.2 app

I am building an application in which front end is iPhone and I am using ROR as my backend with mongoDB as my database. It is a kind of chatting application for which I am using jabber protocol and XMPP server. Now I want that when a user is created in my rails app, the same user should be created on the XMPP server. Any help would be much appreciated.
The ideal situation is to have only a single source for users and configure your XMPP server to use that same service.
For example it is common to have an XMPP server authenticate against LDAP, then all user management is delegated to the LDAP server. The XMPP server doesn't handle user management at all, but defers any user related queries to LDAP.
This would ultimately be more reliable than trying to keep two separate systems in synch. If the user management in your case is custom (which it appears to be), it might mean you will also have to add a custom module/plugin to your XMPP server (you haven't mentioned which one you are using) to use that service.

multiple registration of transport in xmpp protocol

I am working on xmpp protocol and I came across with Gateway concept, in which it allows to communicate to services which uses another protocol like msn,aim,yahoo etc ..
As far as I understand I beleive that it allows only 1 registration for a particular gateway at a time.For example I can register only 1 msn account at a time.I'am not sure if its really true.
Is it possible to register more that 1 account for a particular gateway and how?Please help me with this..
That is true. All gateways I know (e.g. spectrum) only allow one registration per instance. But you can run multiple instances of the smae gateway type e.g.:
icq1.jabberserver.com
icq2.jabberserver.com
That is, additional to run mutliple gateway components to different IM neworks, like
gtalk.jabberserver.com
irc.jabberserver.com
icq.jabberserver.com
msn.jabberserver.com
...
you also run multiple instances of the same gateway component on your server. Please not that this are (internal and/or external) components to your XMPP server and not individual XMPP servers!

How to discover if the currently connected server provides a MUC component

Is it possible, and then how, to discover if the current server provides a MUC component with Smack?
I try to make the configuration for the end user as easy as possible. So that he has to enter just the JID and the password. If the server belonging to the JID has a MUC component, the component should be used for new MUCs. If the server provides no MUC component, a default MUC component is used.
You want to use XEP-0030 (Service Discovery) for this. ServiceDiscoveryManager provides an implementation. Call getInstanceFor(connection), then discoverItems("example.com"), then then discoverInfo(jid) for each item returned from discoverItems. The correct component will implement the http://jabber.org/protocol/muc feature.