Comments (16)
what do you mean by this?
usually i would destroy the variable that holds the handler and then when you disconnect you also have to flush in the process too - and thats what people on the internet do anyway.
i think that way you can manage what you do with the handler in each case.
from strophejs.
Are we talking about the same kind of handlers here? I'm talking about the kind of handlers that you create with connection.addHandler(...)
So, how do you suggest I "destroy the variable that holds the handler"? How do I destroy a variable? Also, you say I should flush in the process. Which process are you talking about? How do I flush it?
Thanks.
from strophejs.
Is anyone around?
from strophejs.
Sorry I forgot to reply, the flush method is within the strophe connection i believe. i will have to sift through my code later and get back to you. hang tight my friend.
from strophejs.
Hi @isfarax , do we have any news? The flush
method does something completely different, it flushes the data, so it's not what I want.
from strophejs.
Hi @akarelas
this is from the book:
var ref = conn.addHandler(my_handler_function, null, “message”);
// once the handler is no longer needed:
connection.deleteHandler(ref);
that is how you should add and remove references to a handler. i hope this is what you are wanting to achieve.
from strophejs.
This doesn't work. I tried it on my websocket-style connection. If you don't believe me, that deleteHandler does absolutely nothing, tell me and I will demonstrate it with a plunkr
from strophejs.
if you are wanting to manage user/connection session, you should look into RID and SID because if the connection gets disconnected then i wouldnt be surprised if the handlers get wiped out too.
from strophejs.
What's RID and SID?
from strophejs.
All I want is to not end up with 150 thousand handlers on my connection, just because the server was down for a minute and my client was trying to reconnect again and again.
from strophejs.
Would you like me to set up a plunkr, to demonstrate to you that deleteHandler does absolutely NOTHING?
from strophejs.
Will you do something about it afterwards, when I've shown it?
from strophejs.
SID (Session Identification) and RID (Reference Identification) are to manage user sessions, typically when a user is attempting to login in again. after you disconnected, you can use the SID and RID to login into the server, it is like taking a shortcut and it is the recommending way of doing it - this also doesnt create 150 thousand connections to your server.
from strophejs.
Does this mean you're not interested in my demonstrating that deleteHandler does nothing?
from strophejs.
i am, show me
from strophejs.
- This works, the deleteHandler function does not do nothing...
var ref = conn.addHandler(my_handler_function, null, “message”);
// once the handler is no longer needed:
connection.deleteHandler(ref);
If you can show us how to reproduce that it doesn't it will be fixed. - The handlers are always flushed after a disconnect and during a reset. Specifically a few lines after the Strophe.Connection Status is set to DISCONNECTED. The only way handlers from a previous session could interfere with a new one would be if you would hook status DISCONNECTING or DISCONNECTED or instantly reconnect before the handlers are cleared. Depending on your hooks for DISCONNECTING or DISCONNECTED the handlers could survive a reconnect for a few seconds.
I'm not really sure why the handlers are currently cleared after DISCONNECTED is set, I'll push a patch that reverses the order here. If you still have problems reopen this.
from strophejs.
Related Issues (20)
- addHandler 'stream:error' can not receive message HOT 2
- XEP-0237 is Obsolete, It is preferable to use it in production system, If not then is there any alternate available? HOT 5
- Uncaught TypeError: (o, strophe_WEBPACK_IMPORT_MODULE_1.$msg) is not a function HOT 1
- Websocket disconnect broken
- strophe > 1.5.0 no longer works in React Native HOT 4
- TypeError: XHTML.validTag is not a function
- video calls HOT 1
- When chatting in multiple groups, Message loss
- When chatting in multiple groups, Message loss HOT 4
- Invalid Token with OAuth HOT 1
- SCRAM-SHA-1-PLUS + SCRAM-SHA-256-PLUS + SCRAM-SHA-512-PLUS + SCRAM-SHA3-512(-PLUS) supports
- TypeError: Cannot read properties of null (reading 'send')
- How to send raw xml string over the connection ?
- Detach old upstream HOT 3
- How to resume a stream as specified in XEP-0198 Stream management ?
- New release build? HOT 2
- Cannot use with NodeJS HOT 7
- Error handling on websocket stream error message
- Wrong order of received bosh responses HOT 3
- Error with Builder.up depending on context HOT 1
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 strophejs.