There is only ONE connection...What Jakob meant is that when you have a MessageSession assigned to JID alice@xxxxxxxxxxx you can't get this MessageSession to send a message to bob@xxxxxxxxxxx because the MessageSession automatically adds the to attribute. Nevermind what you use, MessageSession::send or ClientBase::send, either way the message is sent over ClientBase's TCP socket to the server. Tobias On 2/1/07, Anatoly Gutnick <anatolyg@xxxxxxxxx> wrote:
Thanks Tobias, MessageSession is just a wrapper for 1-to-1 chat... It is Ok. ** *But, it looks that MessageSession:send() always sends message via Jubber server and not directly to * *MessageSession's buddy." - is it correct.* ** I am confused because *Jakob Schroeter wrote:* "Client::send() sends any XML over the wire to the server. MessageSession::send() is limited to sending a single chat message to the MessageSession's buddy." Anatoly ** 2007/2/1, Tobias Markmann <tmarkmann@xxxxxxxxxxxxxx>: > > Hi Anatoly, > > the whole thing with gloox is that it provides object oriented wrappers > for most XMPP stuff. For example the MessageSession you are using was > written to make developers life easier. MessageSession is just a wrapper for > 1-to-1 chat. There are NO extra connections for it. If your existing > connection receives some stanza the MessageSessionHandler will look if there > is already a MessageSession for the sender and if so it'll forward the > stanza to it. The other way around, if you call MessageSession::send() it'll > create a stanza and send it to ClientBase::send(). In the end there is just > ONE XMPP connection and NO additional connection for MessageSession or > anything else. > This library design is nothing special. Many applications and libraries > are using design patterns or something similar and some design patterns are > about delegating certain data to the proper receiver. > > regards > Tobias Markmann * > * > On 2/1/07, Anatoly Gutnick < anatolyg@xxxxxxxxx > wrote: > > > > Jakob Schroeter wrote: > > > > "Client::send() sends any XML over the wire to the server. > > MessageSession::send() is limited to sending a single chat message to > > the > > MessageSession's buddy." > > > > Question: > > > > *Does it mean MessageSession opens connection to the MessageSession's > > buddy or it send it with XMPP over UDP?* > > *And whats happens if MessageSession's buddy closed connection once?* > > ** > > I tried such flow: test1 opened chat session using *MessageSession *and > > send message to test2... > > Then test2 closed connection to Jubber. > > Test1 sends second message using Session:send() ... > > The message was not deliveried (test2 disconnected), but after test2 > > reconnected to Jubber it gots the message. > > > > *So, it looks that MessageSession:send also send message over Jubber > > server - is it correct?* > > *MessageSession Is only abstraction for easy using or it really > > communicate in a different way?* > > > > > > *3) MessageSession:*send( Tag *tag ) is protected. > > I used client->send( Tag *tag ) to pass attributes and childs - not > > only message and body... > > > > I am thinking about changes to do, but would like to understand if i > > really need to use *MessageSession.* > > ** > > *Thanks,* > > *Anatoly* > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2007/1/31, Jakob Schroeter <js@xxxxxxxxxx>: > > > > > > Hi, > > > > > > On Tue Jan 30 2007, Anatoly Gutnick wrote: > > > > Hello, > > > > > > > > What are the actual disadvantages of Client::send(). > > > > Can you please explian the difference in implementation of > > > Client:send and > > > > MessageSession:send > > > > that makes the difference? > > > > > > The 'disadvantage' of Client::send() is that it requires more work > > > from you to > > > achieve what you can do with a single call to > > > MessageSession::send(). > > > > > > Client::send() sends any XML over the wire to the server. > > > MessageSession::send() is limited to sending a single chat message > > > to the > > > MessageSession's buddy. > > > > > > cheers, > > > Jakob > > > > > > > > > -- > > > gloox-dev mailing list > > > to unsubscribe: > > > send a message with subject 'unsubscribe gloox-dev' to > > > minimalist@xxxxxxxxxx > > > > > > > > > > > > > -- > > gloox-dev mailing list > > to unsubscribe: > > send a message with subject 'unsubscribe gloox-dev' to minimalist@xxxxxxxxxx > > > > > > > > -- > gloox-dev mailing list > to unsubscribe: > send a message with subject 'unsubscribe gloox-dev' to > minimalist@xxxxxxxxxx > > -- gloox-dev mailing list to unsubscribe: send a message with subject 'unsubscribe gloox-dev' to minimalist@xxxxxxxxxx