@@ -29,14 +29,15 @@ If the `-Watch` parameter is provided, will output a continous stream of objects
29
29
Create a WebSocket job that connects to a WebSocket and outputs the results.
30
30
31
31
``` 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/"
33
34
```
34
35
Get is the default verb, so we can just say WebSocket.
35
36
` -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
37
38
38
39
``` 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 |
40
41
% {
41
42
$_.commit.record.text
42
43
}
@@ -50,22 +51,25 @@ $blueSkySocketUrl = "wss://jetstream2.us-$(
50
51
"wantedCollections=app.bsky.feed.post"
51
52
) -join '&')"
52
53
websocket $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
54
55
```
55
- > EXAMPLE 4
56
+ Watch continuously in a background job.
56
57
57
58
``` PowerShell
58
59
websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post
59
60
```
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.
61
63
62
64
``` 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
64
68
```
65
69
Watch BlueSky, but just the emoji
66
70
67
71
``` 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 |
69
73
Foreach-Object {
70
74
$in = $_
71
75
if ($in.commit.record.text -match '[\p{IsHighSurrogates}\p{IsLowSurrogates}]+') {
0 commit comments