From 7819ebe6c22e92b4d9bb2e6d9ec6ed8d864f0c0c Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sat, 29 Oct 2022 16:34:22 -0700 Subject: Remove mentions of "obs5" I don't expect to care about protocol versions for a while. --- src/obswebsocket.cr | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/obswebsocket.cr b/src/obswebsocket.cr index 29bcaa6..3dfa5cc 100644 --- a/src/obswebsocket.cr +++ b/src/obswebsocket.cr @@ -118,7 +118,7 @@ module OBSWebSocket def initialize( uri : String ) spawn do loop do - obs5_pubsub = HTTP::WebSocket.new( URI.parse( uri ), HTTP::Headers{"Cookie" => "SESSIONID=1235", "Sec-WebSocket-Protocol" => "obswebsocket.json"} ) + obs_pubsub = HTTP::WebSocket.new( URI.parse( uri ), HTTP::Headers{"Cookie" => "SESSIONID=1235", "Sec-WebSocket-Protocol" => "obswebsocket.json"} ) openrequests = Hash( String, Channel( JSON::Any ) ).new eventsubs = Array( Channel(JSON::Any) ).new #metachan = Channel( Tuple( String, Channel( JSON::Any ) ) ).new @@ -134,7 +134,7 @@ module OBSWebSocket if reschan openrequests[ json["d"]["requestId"].as_s ] = reschan end - obs5_pubsub.send( msg[1] ) + obs_pubsub.send( msg[1] ) end elsif msgtuple[1] == "subscribe events" reschan = msgtuple[0] @@ -149,12 +149,12 @@ module OBSWebSocket if reschan openrequests[ json["d"]["requestId"].as_s ] = reschan end - obs5_pubsub.send( msgtuple[1] ) + obs_pubsub.send( msgtuple[1] ) elsif JSON.parse( msgtuple[1] )["op"].as_i64 == 1 print "SENT: " json = JSON.parse( msgtuple[1] ) pp json - obs5_pubsub.send( msgtuple[1] ) + obs_pubsub.send( msgtuple[1] ) else print "QUEUED: " pp msgtuple[1] @@ -162,14 +162,13 @@ module OBSWebSocket end end end - obs5_pubsub.on_message do | message | + obs_pubsub.on_message do | message | json = JSON.parse( message ) print( "RECEIVED: ") print( json.to_pretty_json ) print( "\n") if json["error"]? puts json["error"] - #ircipc.send( { "#" + settings["reqchan"], "| obs5: #{json["error"]}" } ) next end case json["op"].as_i64 @@ -242,7 +241,7 @@ module OBSWebSocket end end end - obs5_pubsub.run + obs_pubsub.run sleep 10 next end -- cgit v1.2.3