Skip to content

Commit c81e6b9

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Get-WebSocket -Broadcast and -Handler Improvement ( Fixes #84, Fixes #39 )
Making -Broadcast and -Handler work in both client and server scenarios
1 parent 68bc8e0 commit c81e6b9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

docs/Get-WebSocket.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ These will be appended onto the `-SocketUrl`.
223223
|`[IDictionary]`|false |named |true (ByPropertyName)|
224224

225225
#### **Handler**
226-
A ScriptBlock that will handle the output of the WebSocket.
226+
A ScriptBlock that can handle the output of the WebSocket or the Http Request.
227+
This may be run in a separate `-Runspace` or `-RunspacePool`.
228+
The output of the WebSocket or the Context will be passed as an object.
227229

228230
|Type |Required|Position|PipelineInput|
229231
|---------------|--------|--------|-------------|
@@ -274,10 +276,12 @@ The buffer size. Defaults to 16kb.
274276
|`[Int32]`|false |named |false |
275277

276278
#### **Broadcast**
279+
If provided, will send an object.
280+
If this is a scriptblock, it will be run and the output will be sent.
277281

278-
|Type |Required|Position|PipelineInput|
279-
|------------|--------|--------|-------------|
280-
|`[PSObject]`|false |named |false |
282+
|Type |Required|Position|PipelineInput|Aliases|
283+
|------------|--------|--------|-------------|-------|
284+
|`[PSObject]`|false |named |false |Send |
281285

282286
#### **OnConnect**
283287
The ScriptBlock to run after connection to a websocket.
@@ -460,8 +464,8 @@ RunspacePools allow you to limit the scope of the handler to a pool of runspaces
460464

461465
### Syntax
462466
```PowerShell
463-
Get-WebSocket [[-SocketUrl] <Uri>] [-QueryParameter <IDictionary>] [-ForwardEvent] [-Variable <IDictionary>] [-Header <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-Authenticate <PSObject>] [-Handshake <PSObject>] [-Watch] [-RawText] [-Binary] [-Force] [-SubProtocol <String>] [-Filter <PSObject[]>] [-WatchFor <IDictionary>] [-TimeOut <TimeSpan>] [-PSTypeName <String[]>] [-Maximum <Int64>] [-ThrottleLimit <Int32>] [-ConnectionTimeout <TimeSpan>] [-Runspace <Runspace>] [-RunspacePool <RunspacePool>] [-IncludeTotalCount] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]
467+
Get-WebSocket [[-SocketUrl] <Uri>] [-QueryParameter <IDictionary>] [-Handler <ScriptBlock>] [-ForwardEvent] [-Variable <IDictionary>] [-Header <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-Authenticate <PSObject>] [-Handshake <PSObject>] [-Watch] [-RawText] [-Binary] [-Force] [-SubProtocol <String>] [-Filter <PSObject[]>] [-WatchFor <IDictionary>] [-TimeOut <TimeSpan>] [-PSTypeName <String[]>] [-Maximum <Int64>] [-ThrottleLimit <Int32>] [-ConnectionTimeout <TimeSpan>] [-Runspace <Runspace>] [-RunspacePool <RunspacePool>] [-IncludeTotalCount] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]
464468
```
465469
```PowerShell
466-
Get-WebSocket -RootUrl <String[]> [-Route <IDictionary>] [-HTML <String>] [-PaletteName <String>] [-GoogleFont <String>] [-CodeFont <String>] [-JavaScript <String[]>] [-ImportMap <IDictionary>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Header <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-Force] [-TimeOut <TimeSpan>] [-Maximum <Int64>] [-ThrottleLimit <Int32>] [-IncludeTotalCount] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]
470+
Get-WebSocket -RootUrl <String[]> [-Route <IDictionary>] [-HTML <String>] [-PaletteName <String>] [-GoogleFont <String>] [-CodeFont <String>] [-JavaScript <String[]>] [-ImportMap <IDictionary>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Header <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-Force] [-TimeOut <TimeSpan>] [-Maximum <Int64>] [-ThrottleLimit <Int32>] [-Runspace <Runspace>] [-RunspacePool <RunspacePool>] [-IncludeTotalCount] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]
467471
```

0 commit comments

Comments
 (0)