Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
dandorey #1
Member since Aug 2009 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Sending messages to users not in contact list
Hi,

I'm brand new to this SDK and any chat server for that matter so bear with me.

We're hosting chat in our web page and we want to be able to allow users to chat with anyone (online) in the system. There will be (eventually) thousands of users in our system so we'd like to able to send messages to anyone without having them in the contact list. We are currently getting the presense information through the Openfire server through our own mechanism rather than through the client.

Is it possible to send a message to a user that is not part of your contact list? If not, is there a way that this can be done temporarily and transparently to the user? I've read about "directed presence" but I can't tell if that is all that related or not.

Thanks for any direction,
Dan
Avatar
Alex #2
Member since Feb 2003 · 4328 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
if it is possible or not depends on the server you are using and it's configuration. With the most servers its possible by default.

E.g. Google blocks all messages from users not in your list for security reasons (SPIM).

According to your project description I assume that you run your own server, so it's not a problem for you at all.

Alex
This post was edited on 2009-08-28, 20:06 by Alex.
Avatar
dandorey #3
Member since Aug 2009 · 6 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex. We are managing our own server so I will take a look at OpenFire documentation to make sure that setting is correct.

When I send a message to another user I get this response back to the user that sent the message:

<message to="cc1bc674-8ee2-4933-8359-8b3d5d3f3860@web01-dev-vm/MatriX" from="78775df8-51ae-4bb1-8bc4-66bb7ccfedc2" type="error" xmlns="jabber:client">
  <error code="404" type="cancel">
    <remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  </error>
</message>

Any clue what this might be related to? Both users appear online in the server status page before I try and send this message.

I'm currently sending the message like this:

Message msg = new Message();
msg.To = user.ID.ToString(); // user.ID is a GUID (we've made user names to match)
msg.Type = MessageType.chat;
msg.Body = "First Message!";
_xmppClient.Send(msg);

Is it possible that I have to specifiy the server and resource of the msg.To JID?

Thanks,
Dan
Avatar
dandorey #4
Member since Aug 2009 · 6 posts
Group memberships: Members
Show profile · Link to this post
Setting the server and resource did the trick. However I had to grab that information from the server manager. Do I have any way of getting this information through the client without the contact being in my list?

Sorry again for the novice questions!

Dan
Avatar
Alex #5
Member since Feb 2003 · 4328 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
of course you need the server.
The addressing is always user@server/resource

But you don't need the resource. If no resource is present then the server delivers the message to the most available resource.
Resources are only important with Iq stanzas, and a user is logged in from different clients multiple times with multiple resources.

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