Hi Thomas,
Thomas Kratz wrote:
> Hi,
>
> I am quite new and I hope I send this to the right list.
It is. Welcome.
Noticed your blog post today. Thanks for mentioning Vysper. :-)
Though, to be fair there is at least one more Apache-licensed XMPP
server out there, doubly licensened GPL and ASL, AFAIR - don't remember
the name from the top of my head right now.
> I just
> started off with vysper and I found that I don't get notofied when the
> connection gets lost (for example when I force eclispe to shut down my
> process, I still see the user as available.
>
> I dived into the code and found some todo's in AbstractSessionContext:
>
> public void endSession() {
> // thats one of my first ideas
> LatestPresenceCache presenceCache
> =getServerRuntimeContext().getPresenceCache();
> PresenceStanza stanza = presenceCache.remove(initiatingEntity);
>
> StanzaWriter stanzaWriter = getResponseWriter();
> stanzaWriter.close();
> sessionStateHolder.setState(SessionState.CLOSED); // no more
> traffic going through
> getServerRuntimeContext().getResourceRegistry().unbindSession(this);
> // TODO send unavailable to all contacts and other resources
> // TODO remove latest availability from LatestPresenceCache
> // TODO close underlying transport (TCP socket)
> }
>
> I dont have to exact knowledge of the protocol, but could you give me
> a hint if this is ok so far and how I can get the roster of the entity
> to send them unavailable Stanzas ?
First, I think you're looking at the right piece of code.
I don't think it's that easy.
endSession() gets called in different situations. One of them is after
sending out a stream error. According to the spec, you MUST not send any
more stanzas after that to the client(!), so no unavail stanza in that
direction, we have to make sure of that (have a test). Contacts might
receive the unavailable regardless of this.
However, when the client abruptly goes away, there should be graceful
notifications. This is already handeled by
PresenceAvailabilityHandler.handleOutboundUnavailable(). Maybe it would
be feasible to go that path (by somehow mocking an unavailable stanza).
Additionally, we should check if when the server goes down we can still
send out those unavailables. Maybe we can't.
If the server closes the connection unilaterally, it should send
</stream:stream> to the client. This must be taken care of.
The relevant section of the XMPP spec is here
http://xmpp.org/internet-drafts/draft-ietf-xmpp-3920bis-04.html#streams-close
> Any help would be appreciated.
Do you think you can come up with a patch for any of those?
Bernd