Identifying clients when pushing data from server - server

I have been tasked with creating a windows client/server application which can push messages from a server to clients on the internet. Clients will receive messages based on a group membership but they do not "log in" anywhere. How can I identify each client in that scenario? Is there something unique about a machine I can use to make the group membership and also use to identify the machine when connected to the server?

Related

How can I create multiple independent conversations between two users in XMPP Server?

I want to create a chat where multiple independent conversations can be created between two users in my XMPP Server (MongooseIM).
I tried to do it with threads but it does not work since when I log in if the user has messages offline, the server marks the messages as read. Or if I send a message to the other user, the server marks all messages as read.
Do you think it would be the solution to use MUC?, or can I do it without using MUC?

Sharing Jabber chat session between multiple clients

I'm using Jitsi on client side and ejabberd on server.
It seems that the chat sessions are specific to clients, i.e. if I'm logged in to the same account from 2 different clients, there will be 2 separate sessions, and one can't see what's happening in another.
Is it possible to share the sessions for the same account on all clients? Like Skype or GTalk.
If yes, is it a server configuration or client?
Thank you.
I think what you're looking for is XEP-0280 Message Carbons. Basically the server takes care of relaying the chat to all of your online resources so that you have the same chat session across all devices.
You even get chatstates from all of your other resources so you can infer whether or not you should show an unread IM notification to the user on your resource or not. You'll need client and server support for this, and it looks like ejabberd has implemented it via this module.

Detecting other clients using the same account in XMPP

XMPP allows users to connect to the server from multiple clients simultaneously, using the same account. I built an application that does this but if the desktop client is enabled, I do not want the users to be able to connect using a mobile client. This is for a game and being connected to both causes problems.
So what I'm wondering is:
Is it possible to detect if there are other clients connected using the same account. If I can check for other clients, I can auto logout the user.
#Flow was on the right track. If all of your client instances use the same resource, in most servers, the later-connecting client will replace the older session. The older session will get a conflict stream error, and be disconnected. You MUST be careful not to auto-reconnect with the older client, or you will have written the "dueling resources" bug.
If you had control over your server, you have a chance at configuring it to allow a maximum of one resource for a given user, in which case the newer connection will fail with a conflict error, but you'll have worse user interface problems if you head down that path; there will be no way to get the second client logged in, even if you wanted to.
Finally, all resources for a given user are subscribed to that user's presence. As long as your client sends presence in:
<presence/>
you will receive presence from each of your other devices:
<presence to='user#example.com/resource1' from='user#example.com/resource2'/>
<presence to='user#example.com/resource1' from='user#example.com/resource3'/>
<presence to='user#example.com/resource1' from='user#example.com/resource4'/>
You could use this to decide which client is current, perhaps by adding an extension to the presence like XEP-0115.
Give the desktop and mobile client a fixed but different resource string. If the mobile client logs in, it can detect the presence of the desktop client by looking up the presence/availability of the resource of the desktop client and vice versa.
Then you only need to implement an custom XMPP ad-hoc command (XEP-0050) that tells the conflicting resource to log out.
It would be the servers responsibility: to reject a login from a client that is not accepted. I don't know if servers are able to blacklist xmpp clients but, in case you use openfire, you should be able to write an extension.

How to receive emails of the same inbox from multiple server instances

I have an application running on WebLogic Server with 6 instances. Many requests for the application come from Email. We already set up an email account that will be used by all clients to send email to. But the problem is that the email account inbox can only be opened for reading by a single connection, unlike a typical database.
Currently I can only deploy the email reading service on a single server instance, this will effectively create a single point of failure and unbalanced load. What's the best way to read from the same inbox from multiple servers? I am thinking developing something using a database table, sort of leasing, whoever locked the table own the lease and can connect to the email server, but this is pretty hard to implement correctly in all circumstances.
I am not sure why you say that only one client can access the inbox as POP certainly can handle multiple connections to the same inbox and this can be configured in the mail server. You might need to talk to your mail server admin.
I haven't worked with Weblogic to give you a specific answer, but you should also be able to have a service written that checks the incoming mail and process incoming mails into a database as you wanted. Once the information is in a database, you can use it via multiple hosts. This is a better approach as this can be setup to prevent multiple clients responding to the same email.

XMPP server-to-server - traffic optimization?

I'm working on a design for a xmpp chat solution which involves some servers and where at least one server is connected with serious bandwidth limitations.
Assuming, we have two servers A and B, some users 0..n connected to Server A and some conferences 0..m provided by Server B.
Now assume, some users enter a conference room and a message is sent to that room. Will
Server B send this message once to
Server A and Server A distributes it
to the users or will
Server B send this message to each individual user of Server A?
According to the protocol spec, XEP 045, multi-user chat messages are reflected independently to each participant. I can't tell on a brief read if it is legal to send them server-to-server without reflecting. However, it might be worth asking this question on an xmpp.org mailing list, where the experts tend to hang out.