websocketd/tests/performances/ipc_connection.cr

18 lines
354 B
Crystal

require "benchmark"
require "ipc"
require "../test-ws"
ws_uri = "ws://localhost:1234/pong.JSON"
message = IPC::Message.from_json(%({ "mtype" : 3, "utype" : 30, "payload" : "coucou" }))
Benchmark.ips do |bm|
bm.report("connection") do
c = IPC::Client.new "pong"
end
bm.report("connection through websocket") do
tws = TestWS.new ws_uri
end
end