Comments (5)
@genofire Any opinion on this?
Do you like the prototype API to create packets better ?
from go-xmpp.
unnecessary complicated
for me the source code is easier to read, if it is formated like before.
from go-xmpp.
Thanks for feedback.
I committed my exploration in that branch: https://github.com/FluuxIO/go-xmpp/tree/builder-exploration/pkg/stanza to give you a better idea.
I feel that at some point the code may be difficult to navigate, with the pure parsing / packet formatting part, being mixed with client, component workflow and connection manager.
Separating the stanza building, marshalling and unmarshalling maybe help structure the code better as it grows (and I did not add test modules for all the structure generation, yet).
I think it should still be possible to use the full expending stanza version as well.
Anyway, still thinking about it, as you find this complicated. Maybe I will end up doing something in between (move to a separate package but remove the builder interface).
I am also afraid that godoc will become unusable if we do no split the XML marshalling / unmarshalling part: https://godoc.org/gosrc.io/xmpp
from go-xmpp.
Using pointers, I managed to have a prototype of approach that can further reduce building an IQ with payload, as follows:
iq := stanza.NewIQ(stanza.Attrs{Type: "get", To: "service.localhost", Id: "disco-get-1"})
disco := iq.DiscoInfo()
disco.AddIdentity("Test Component", "gateway", "service")
disco.AddFeatures(stanza.NSDiscoInfo, stanza.NSDiscoItems, "jabber:iq:version", "urn:xmpp:delegation:1")
from go-xmpp.
@genofire Several things to note for upgrade:
- There is now a stanza package to host parsing and stanza structure. It should help make the project structure more obvious.
- On DiscoInfo package, you can have several identities. For future reference, see example 2 in XEP-0030: https://xmpp.org/extensions/xep-0030.html#example-2
Other than that, you are not force to use shortcuts and can keep on relying on building the stanza with structs, as before.
from go-xmpp.
Related Issues (20)
- SIGSEGV in xmpp_component example with Prosody HOT 1
- Implementation of stanza acknowledgement (XEP-0198) HOT 2
- PubSub stanza should be more generic HOT 1
- Improve error handling HOT 1
- Make keepalive configurable
- Add support for roster IQ stanzas HOT 4
- Support Message Archive Management (XEP-0313)
- Support XEP-0199: Reply to client or server initiated Ping
- Prosody & "echo" demo: not receiving any messages HOT 8
- XEP-0045: Cannot distinguish between empty subject and no subject HOT 1
- XEP-0045: Presences and messages arriving out of order; clients can interpret room join as complete before all `<presence/>`s landed
- stanza.Err makes 'code' non-optional
- Golang XML vulnerabilities HOT 3
- Cannot connect FluuxIO to MongooseIM
- "Echo" example from README should following RFC6121
- panic in session
- (stanza.IQ).MakeError: On including sender XML
- 【FEATURE】implementing ANONYMOUS auth mechanism ?
- InitialPresence should not be a constant
- GetDecoder() on an XMPP transport is called before Connect() 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 go-xmpp.