summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2022-10-29 16:34:22 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2022-10-29 16:43:51 -0700
commit7819ebe6c22e92b4d9bb2e6d9ec6ed8d864f0c0c (patch)
treeaedd205498b28823ac9e42f2604ae2997ccf5e55
parent0637727038092467c30b604efe6752ef20432487 (diff)
downloadcrystal-obs-websocket-7819ebe6c22e92b4d9bb2e6d9ec6ed8d864f0c0c.tar.gz
crystal-obs-websocket-7819ebe6c22e92b4d9bb2e6d9ec6ed8d864f0c0c.zip
Remove mentions of "obs5"
I don't expect to care about protocol versions for a while.
-rw-r--r--src/obswebsocket.cr13
1 files 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