Skip to content

Commit f79d058

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Get-WebSocket -TimeOut ( Fixes #23 )
1 parent 5427701 commit f79d058

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

docs/Get-WebSocket.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,25 @@ $emojiPattern = '[\p{IsHighSurrogates}\p{IsLowSurrogates}\p{IsVariationSelectors
4141
websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail |
4242
Foreach-Object {
4343
$in = $_
44+
$spacing = (' ' * (Get-Random -Minimum 0 -Maximum 7))
4445
if ($in.commit.record.text -match "(?>(?:$emojiPattern|\#\w+)") {
45-
Write-Host $matches.0 -NoNewline
46+
$match = $matches.0
47+
Write-Host $spacing,$match,$spacing -NoNewline
4648
}
4749
}
4850
```
51+
> EXAMPLE 5
52+
53+
```PowerShell
54+
websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Watch |
55+
Where-Object {
56+
$_.commit.record.embed.'$type' -eq 'app.bsky.embed.external'
57+
} |
58+
Foreach-Object {
59+
$_.commit.record.embed.external.uri
60+
}
61+
```
62+
> EXAMPLE 6
4963
5064
---
5165

@@ -128,6 +142,13 @@ If set, will watch the output of the WebSocket job, outputting results continuou
128142
|----------|--------|--------|-------------|-------|
129143
|`[Switch]`|false |named |false |Tail |
130144

145+
#### **TimeOut**
146+
The timeout for the WebSocket connection. If this is provided, after the timeout elapsed, the WebSocket will be closed.
147+
148+
|Type |Required|Position|PipelineInput|
149+
|------------|--------|--------|-------------|
150+
|`[TimeSpan]`|false |named |false |
151+
131152
#### **ConnectionTimeout**
132153
The maximum time to wait for a connection to be established.
133154
By default, this is 7 seconds.
@@ -156,5 +177,5 @@ RunspacePools allow you to limit the scope of the handler to a pool of runspaces
156177

157178
### Syntax
158179
```PowerShell
159-
Get-WebSocket [[-WebSocketUri] <Uri>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-Watch] [-ConnectionTimeout <TimeSpan>] [-Runspace <Runspace>] [-RunspacePool <RunspacePool>] [<CommonParameters>]
180+
Get-WebSocket [[-WebSocketUri] <Uri>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-Watch] [-TimeOut <TimeSpan>] [-ConnectionTimeout <TimeSpan>] [-Runspace <Runspace>] [-RunspacePool <RunspacePool>] [<CommonParameters>]
160181
```

0 commit comments

Comments
 (0)