You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/defabricated/go-obs-websocket

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/defabricated/go-obs-websocket

v0.0.0-20191014083747-8d87f8483ec2
Source
Go
Version published
Created
Source

go-obs-websocket

GoDoc

go-obs-websocket allows to connect to Open Broadcaster Studio plugin obs-websocket.

Installation

go get github.com/czlowiekenigma/go-obs-websocket

Usage

Create a new client using

client, err := obsws.NewClient(ip, port)
if err != nil {
    panic(err)
}

Check if auth is required, if it is - authenticate using password

authRequired, err := client.GetAuthRequired()
if err != nil {
    panic(err)
}

if authRequired.AuthRequired {
    if err := client.Authenticate(password, authRequired); err != nil {
        panic(err)
    }
}

Send request without response

if err := client.StartStopStreaming(); err != nil {
    panic(err)
}

Send request with expected response

streamingStatusResponse, err := obsClient.GetStreamingStatus()
if err != nil {
	panic(err)
}

log.Printf("Streaming: %v, recording: %v\n", streamingStatusResponse.Streaming, streamingStatusResponse.Recording)

Handle events

for {
    event := <-client.EventChannel()
    
    //Listen for StreamStopped event
    if _, ok := e.(*events.StreamStopped); ok {
        log.Println("Stream has stopped!")
    }
}

FAQs

Package last updated on 14 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts