Categorygithub.com/onthegit/goobs
modulepackage
1.0.4
Repository: https://github.com/onthegit/goobs.git
Documentation: pkg.go.dev

# README

goobs

Protocol Version Documentation Build Status Go Report

Interact with OBS Studio from Go!

installation

To use this library in your project, add it as a module after you've initialized your own:

❯ go mod init github.com/beautifulperson/my-cool-obs-thing
❯ go get github.com/onthegit/goobs

usage

The following example connects to the server and prints out some versions.

Check out the docs for more info, or just jump right into the other examples!

package main

import (
	"fmt"

	"github.com/onthegit/goobs"
)

func main() {
	client, err := goobs.New("localhost:4455", goobs.WithPassword("goodpassword"))
	if err != nil {
		panic(err)
	}
	defer client.Disconnect()

	version, err := client.General.GetVersion()
	if err != nil {
		panic(err)
	}

	fmt.Printf("OBS Studio version: %s\n", version.ObsVersion)
	fmt.Printf("Server protocol version: %s\n", version.ObsWebSocketVersion)
	fmt.Printf("Client protocol version: %s\n", goobs.ProtocolVersion)
	fmt.Printf("Client library version: %s\n", goobs.LibraryVersion)
}

The corresponding output:

❯ go run _examples/basic/main.go
OBS Studio version: 30.1.0
Server protocol version: 5.4.2
Client protocol version: 5.4.2
Client library version: 1.2.2

# Packages

Package api is the intermediary API between the top-level goobs client and the category-level subclients.

# Functions

New creates and configures a client to interact with the OBS websockets server.
WithDialer sets the underlying [gorilla/websocket.Dialer] should one want to customize things like the handshake timeout or TLS configuration.
WithEventSubscriptions specifies the events we'd like to subscribe to via [Client.Listen].
WithLogger sets the logger this library will use.
WithPassword sets the password of a client.
WithRequestHeader sets custom headers our client can send when trying to connect to the WebSockets server, allowing us specify the origin, subprotocols, or the user agent.
WithResponseTimeout sets the time we're willing to wait to receive a response from the server for any request, before responding with an error.

# Variables

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Client represents a client to an OBS websockets server.

# Type aliases

Option represents a functional option of a Client.