#!/bin/env tclsh
package require logger
set msgs 0
set start [clock seconds]
proc on_ws {sock mode data} {
global start
global msgs
incr msgs
set dur [expr {[clock seconds] - $start}]
puts -nonewline "Recieved $msgs messages in $dur seconds. [expr {$msgs / ($dur+1)}] msgs/sec\r"
flush stdout
}
source ws.tcl
::ws::c::connect jetstream2.us-east.bsky.network 443 /subscribe?wantedCollections=app.bsky.feed.post on_ws
vwait nil