~aleteoryx/tclfeed-bsky

ref: 9f9f4f965c01b6178d4bbd48bc0b4926632a210c tclfeed-bsky/main.tcl -rwxr-xr-x 441 bytes
9f9f4f96Aleteoryx That's enough code to listen to jetstream a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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