Created
February 14, 2020 08:38
-
-
Save ninoseki/5f882ee7ec12cc4818a99f4641f2d96b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "faye/websocket" | |
require "eventmachine" | |
require "json" | |
EM.run { | |
ws = Faye::WebSocket::Client.new("ws://127.0.0.1:4000", nil, ping: 10) | |
ws.on :message do |event| | |
message = JSON.parse(event.data) | |
all_domains = message.dig("data", "leaf_cert", "all_domains") | |
not_before = message.dig("data", "leaf_cert", "not_before") | |
if all_domains && not_before | |
puts({ all_domains: all_domains, not_before: Time.at(not_before) }.to_json) | |
end | |
end | |
ws.on :close do |event| | |
p [:close, event.code, event.reason] | |
ws = nil | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment