@@ -29,14 +29,15 @@ If the `-Watch` parameter is provided, will output a continous stream of objects
2929Create a WebSocket job that connects to a WebSocket and outputs the results.
3030
3131``` PowerShell
32- Get-WebSocket -SocketUrl "wss://localhost:9669/"
32+ $socketServer = Get-WebSocket -RootUrl "http://localhost:8387/" -HTML "<h1>WebSocket Server</h1>"
33+ $socketClient = Get-WebSocket -SocketUrl "ws://localhost:8387/"
3334```
3435Get is the default verb, so we can just say WebSocket.
3536` -Watch ` will output a continous stream of objects from the websocket.
36- For example, let's Watch BlueSky, but just the text.
37+ For example, let's Watch BlueSky, but just the text
3738
3839``` PowerShell
39- websocket wss://jetstream2.us-west.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Watch |
40+ websocket wss://jetstream2.us-west.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Watch -Maximum 1kb |
4041 % {
4142 $_.commit.record.text
4243 }
@@ -50,22 +51,25 @@ $blueSkySocketUrl = "wss://jetstream2.us-$(
5051 "wantedCollections=app.bsky.feed.post"
5152) -join '&')"
5253websocket $blueSkySocketUrl -Watch |
53- % { Write-Host "$(' ' * (Get-Random -Max 10))$($_.commit.record.text)$($(' ' * (Get-Random -Max 10)))"}
54+ % { Write-Host "$(' ' * (Get-Random -Max 10))$($_.commit.record.text)$($(' ' * (Get-Random -Max 10)))"} -Max 1kb
5455```
55- > EXAMPLE 4
56+ Watch continuously in a background job.
5657
5758``` PowerShell
5859websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post
5960```
60- > EXAMPLE 5
61+ Watch the first message in -Debug mode.
62+ This allows you to literally debug the WebSocket messages as they are encountered.
6163
6264``` PowerShell
63- websocket wss://jetstream2.us-west.bsky.network/subscribe -QueryParameter @{ wantedCollections = 'app.bsky.feed.post' } -Max 1 -Debug
65+ websocket wss://jetstream2.us-west.bsky.network/subscribe -QueryParameter @{
66+ wantedCollections = 'app.bsky.feed.post'
67+ } -Max 1 -Debug
6468```
6569Watch BlueSky, but just the emoji
6670
6771``` PowerShell
68- websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail |
72+ websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail -Max 1kb |
6973 Foreach-Object {
7074 $in = $_
7175 if ($in.commit.record.text -match '[\p{IsHighSurrogates}\p{IsLowSurrogates}]+') {
0 commit comments