Skip to content
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

JSJaCIQ.reply cloning the request #55

Open
gavllew opened this issue May 23, 2013 · 2 comments
Open

JSJaCIQ.reply cloning the request #55

gavllew opened this issue May 23, 2013 · 2 comments

Comments

@gavllew
Copy link

gavllew commented May 23, 2013

I'm not sure if this is strictly incorrect behaviour, but thought I would bring this up as a discussion point. Are there any cases where you want the contents of the request to be duplicated in the response? I've only used iq stanzas for roster operations so far, but all that seems to be needed there is an empty iq with type='result'.

Wouldn't it be better to start with an empty iq, and just set the 'to', 'type' and 'id' attributes based on the request?

Looks like the same logic may also apply to JSJaCPacket.errorReply().

@sstrigler
Copy link
Owner

Hmmm. Probably you're right, but I'm pretty sure I had sth in mind when I wrote this function (as by that time I needed it at some of my projects). Regarding errorReply the payload is definitely needed as it is common and probably good practice to send back the original request payload for easier debugging and reference.

@gavllew
Copy link
Author

gavllew commented May 29, 2013

OK, I agree with the error replies - RFC 6120 section 8.3.1. specifies that implementations MAY include the original XML, and this makes sense.

As for normal replies, maybe provide a parameter, or a pair of helper functions - one that prepares an empty reply, and another that prepares a cloned reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants