Comments (8)
sessionClosedHandler doesn't exist anymore in the git version.
But when the session is closed, nothing special happens. There won't be any more incoming stanzas, so pullMessage etc. block indefinitely and outbound stanzas will remain in the outgoing stanza channel
(That will probably change in the future. I'm not too happy with the outgoing stanza channel since there's no way to tell whether a stanza has actually been sent. The reason for it's existence is to buffer stanzas in case the connection is closed. I'm not even sure this behaviour is desirable )
from pontarius-xmpp.
Having some way to attempt reconnect and/or notify the user when the connection goes away is important, otherwise everything just blocks and we lose data.
from pontarius-xmpp.
There's the connectionClosedHandler that is called when the connection goes down. The code to handle reconnecting is basically there but I needs some work because we changed the API around a lot. It's on the top of my laundry list.
from pontarius-xmpp.
We have implemented the reconnect functionality (see reconnect, reconnect' and reconnectNow). It can be used like this:
session (...) config {onConnectionClosed = \s e -> do
liftIO $ reconnect' s
liftIO $ sendPresence presenceOnline s
return ()
}
Note that reconnect* doesn't set your presence to online, so you have to do it yourself.
You can end the sesseion with endSession. This will kill the associated threads and close the connection. (note that the connectionClosedHandler will not be called in this case. This is intentional as to avoid possibly calling reconnect). Since the only way this can happen is if you call endSession yourself, you can set up your own machinery to avoid blocking on getMessage or similar when you are ending the session.
from pontarius-xmpp.
Thanks! I will try this stuff out soon :)
from pontarius-xmpp.
Is the intent, then, that when a message send fails my application code will wait for some time and then resend, or similar?
from pontarius-xmpp.
Yes. Inform the user that the message couldn't be sent at this moment and/or wait for some time and try to resend.
from pontarius-xmpp.
I might be stating the obvious here, but please note that if you want confirmation that the stanza has actually been received, a True
value will not suffice, and you should send an IQ request instead.
from pontarius-xmpp.
Related Issues (20)
- can't compile 0.4.2.2 HOT 2
- `tests/Main.hs` references missing modules HOT 1
- Test source files missing from .cabal file HOT 1
- Session support doesn't check stream features HOT 1
- XEP-0114: external components HOT 3
- Support for nonzas
- Support connecting to UNIX sockets HOT 2
- Jid resource part fails on @ and / chars HOT 4
- fix git tag in cabal file
- Problem handling very long non-ascii messages HOT 3
- JID Read Instance Not Declared Properly HOT 1
- TcpConnectionFailure when no SRV records are found
- Tests fail because files are not exposed HOT 3
- Use for server HOT 4
- xpStreamElement pickles nonza as a stanza
- make xmppBind opt-in
- Cannot build with ghc-8.4.3
- XEPs repo? HOT 1
- SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) supports
- Dead contact link in README HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pontarius-xmpp.