Comments (1)
Yeah i had to fiddle a bit too but joining a MUC is simple, once you got the hang of it. Looking into XMPP documentation also helps, see XEP0045.
I did it in the postconnect handler of the streammanger here but you should be able to do it whenever you want, as long as the client is connected
func postConnect(s xmpp.Sender) {
client, ok := s.(*xmpp.Client)
if !ok {
fmt.Println("post connect sender not a client, cannot proceed")
//error handling
}
//I used uuids to make sure the id is unique
uuid, _ := uuid.NewV4()
id := uuid.String()
//prepare presence for joining the MUC
presence := stanza.NewPresence(stanza.Attrs{
To: "<mucroom>@<xmppdomain_supporting_muc>/<muc_nickname>",//fill the fields accordingly
From: client.Session.BindJid,
Id: id,
})
//as stated in the XEP0045 documentation, you have to tell that you are able to speak muc
presence.Extensions = append(presence.Extensions, stanza.MucPresence{})
//send the stuff and actually join the MUC
err := client.Send(presence)
if err != nil {
//err handling
}
}
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.