-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add id to iq ping stanza #93
Conversation
Increments a new id for each ping. Currently, no id is provided so the response from the server is: `[Tue Oct 06 2015 12:18:47 GMT-0700 (PDT)] ERROR [xmpp error]<iq type="error" xmlns:stream="http://etherx.jabber.org/streams"><error type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Missing 'id'</text></error></iq>`
I think it's safe to have a static id, something like |
@anupdhml An increment avoids goofy servers grumping about duplicate ids. I am not sure this is a real concern though. |
I used an increment because I saw the Frankly, after reading the xmpp spec, I'm starting to think this PR may not be the best idea. It's best to strictly adhere to the specs, right? Feel free to close this if you share the same concern. |
No, Javascript uses 64bit floats for numbers. Which gives millions of years at one ping per second. |
@pixelrebel what's wrong about this PR regarding the spec? BTW the spec was has a newer revision http://xmpp.org/rfcs/rfc6120.html |
@sonnyp Nothing, I suppose. Looks like id is a required attribute for iq stanzas. Shall we move forward with this PR? Oh and thanks for the version update. A nice christmas present! |
There are some merge conflicts. Can you fix them @pixelrebel? If not I can do it before merging. |
@@ -108,7 +109,7 @@ class XmppBot extends Adapter | |||
@reconnectTryCount = 0 | |||
|
|||
ping: => | |||
ping = new ltx.Element('iq', type: 'get') | |||
ping = new ltx.Element('iq', type: 'get', id: @currentIqId++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Stanza('iq', ...
cool, thanks @pixelrebel |
0.2.1 tagged and published to npm. |
Thanks gents! |
Increments a new id for each ping. Currently, no id is provided so the response from the server is:
[Tue Oct 06 2015 12:18:47 GMT-0700 (PDT)] ERROR [xmpp error]<iq type="error" xmlns:stream="http://etherx.jabber.org/streams"><error type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Missing 'id'</text></error></iq>