mirror of https://github.com/FluuxIO/go-xmpp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
355401aa84 | 5 years ago | |
---|---|---|
_examples | 5 years ago | |
cmd/xmpp-check | 5 years ago | |
.gitignore | 5 years ago | |
CODE_OF_CONDUCT.md | 6 years ago | |
CONTRIBUTING.md | 6 years ago | |
Dockerfile | 5 years ago | |
LICENSE | 7 years ago | |
README.md | 5 years ago | |
auth.go | 5 years ago | |
backoff.go | 5 years ago | |
backoff_test.go | 5 years ago | |
check_cert.go | 5 years ago | |
client.go | 5 years ago | |
client_test.go | 5 years ago | |
codecov.yml | 5 years ago | |
codeship-services.yml | 7 years ago | |
codeship-steps.yml | 7 years ago | |
codeship.env.encrypted | 7 years ago | |
component.go | 5 years ago | |
component_test.go | 5 years ago | |
config.go | 5 years ago | |
conn_error.go | 5 years ago | |
doc.go | 6 years ago | |
go.mod | 5 years ago | |
go.sum | 5 years ago | |
iot_control.go | 5 years ago | |
iot_control_test.go | 5 years ago | |
iq.go | 5 years ago | |
iq_test.go | 5 years ago | |
jid.go | 5 years ago | |
jid_test.go | 5 years ago | |
message.go | 5 years ago | |
message_test.go | 5 years ago | |
msg_chat_markers.go | 5 years ago | |
msg_chat_state.go | 5 years ago | |
msg_oob.go | 5 years ago | |
msg_receipts.go | 5 years ago | |
msg_receipts_test.go | 5 years ago | |
ns.go | 6 years ago | |
packet.go | 6 years ago | |
parser.go | 5 years ago | |
pep.go | 5 years ago | |
presence.go | 6 years ago | |
presence_test.go | 5 years ago | |
registry.go | 5 years ago | |
registry_test.go | 5 years ago | |
session.go | 5 years ago | |
socket_proxy.go | 5 years ago | |
starttls.go | 5 years ago | |
stream.go | 5 years ago | |
stream_manager.go | 5 years ago | |
stream_test.go | 5 years ago | |
tcp_server_mock.go | 6 years ago | |
test.sh | 6 years ago | |
xmpp_test.go | 5 years ago |
README.md
Fluux XMPP
Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT.
The goal is to make simple to write simple adhoc XMPP clients:
- For automation (like for example monitoring of an XMPP service),
- For building connected "things" by plugging them on an XMPP server,
- For writing simple chatbot to control a service or a thing.
- For writing XMPP servers components.
The library is designed to have minimal dependencies. For now, the library does not depend on any other library.
Example
Here is a demo "echo" client:
package main
import (
"fmt"
"log"
"os"
"gosrc.io/xmpp"
)
func main() {
config := xmpp.Config{
Address: "localhost:5222",
Jid: "test@localhost",
Password: "test",
PacketLogger: os.Stdout,
Insecure: true,
}
client, err := xmpp.NewClient(config)
if err != nil {
log.Fatalf("%+v", err)
}
// If you pass the client to a connection manager, it will handle the reconnect policy
// for you automatically.
cm := xmpp.NewClientManager(client, nil)
err = cm.Start()
if err != nil {
log.Fatal(err)
}
// Iterator to receive packets coming from our XMPP connection
for packet := range client.Recv() {
switch packet := packet.(type) {
case xmpp.Message:
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
reply := xmpp.Message{PacketAttrs: xmpp.PacketAttrs{To: packet.From}, Body: packet.Body}
_ = client.Send(reply)
default:
_, _ = fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
}
}
}
Documentation
Please, check GoDoc for more information: gosrc.io/xmpp