35 lines
523 B
Go
35 lines
523 B
Go
package slobs
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func Test_StreamlabsOBS(t *testing.T) {
|
|
c := NewClient("127.0.0.1:59650")
|
|
|
|
err := c.Connect()
|
|
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
closeCh := make(chan struct{}, 1)
|
|
|
|
c.Auth("a", func(err error) {
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
closeCh <- struct{}{}
|
|
return
|
|
}
|
|
|
|
c.Subscribe("StreamingService", "replayBufferStatusChange", func(event *ResourceEvent) {
|
|
var status string
|
|
event.DecodeTo(&status)
|
|
log.Println("Event received:", status)
|
|
})
|
|
})
|
|
|
|
<-closeCh
|
|
}
|