Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active February 5, 2022 13:36
Show Gist options
  • Save hiroyuki-sato/c74c3448b4ebfd42356f077c15c81e26 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/c74c3448b4ebfd42356f077c15c81e26 to your computer and use it in GitHub Desktop.
あやめのログを整形する
#!/usr/bin/env ruby
require 'json'
=begin
KEYS = %[
clientID
connectionId
message
messageroomId
roomId
time
type
]
MKEYS = %[
authnMetadata
clientId
ice
key
roomId
sdp
type
]
=end
while(line = ARGF.gets)
json = JSON.load(line)
puts "-"*80
puts(" clientID: #{json['clientID']}")
puts(" connectionId: #{json['connectionId']}")
puts("messageroomId: #{json['messageroomId']}")
puts(" roomId: #{json['roomId']}")
puts(" time: #{json['time']}")
if( json["message"] )
m = JSON.load(json["message"])
print("*" * 35)
print(" message ")
puts("*" * 36)
#puts("**** Message ****")
if(m["ice"])
#ice = JSON.load(m["ice"])
puts(" type: #{m['type']}")
m["ice"].each do |k,v|
puts("#{k}: #{v}")
end
elsif m["sdp"]
sdp = m["sdp"]
puts("type: #{m['type']}")
puts sdp
elsif m["type"] == "register"
m.each do |k,v|
puts("#{k}: #{v}")
end
else
puts "**** check ****"
puts m
end
# puts m.keys.join("\n")
end
puts ""
puts ""
end
--------------------------------------------------------------------------------
clientID: 86284739885136306
connectionId: 01FV44TCZK085MNHSCZPQX051M
messageroomId:
roomId: XXXXXXXXXXXXXXXXXXXXXXX
time: offer
*********************************** message ************************************
type: offer
v=0
o=- 6400564562865853543 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=extmap-allow-mixed
a=msid-semantic: WMS ij8ja6r2HoHROas0M1zNuS9nozrJv5GYRsLE
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment