Skip to content

Commit c3bc713

Browse files
author
James Brundage
committed
feat: Get-WebSocket -ForwardEvent ( Fixes #56 )
2 parents be9f910 + 10bd595 commit c3bc713

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To stop watching a websocket, simply stop the background job.
4646

4747
~~~powershell
4848
# Create a WebSocket job that connects to a WebSocket and outputs the results.
49-
Get-WebSocket -WebSocketUri "wss://localhost:9669/"
49+
Get-WebSocket -SocketUrl "wss://localhost:9669/"
5050
~~~
5151
#### Get-WebSocket Example 2
5252

docs/Get-WebSocket.md

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If the `-Watch` parameter is provided, will output a continous stream of objects
2020
Create a WebSocket job that connects to a WebSocket and outputs the results.
2121

2222
```PowerShell
23-
Get-WebSocket -WebSocketUri "wss://localhost:9669/"
23+
Get-WebSocket -SocketUrl "wss://localhost:9669/"
2424
```
2525
Get is the default verb, so we can just say WebSocket.
2626
`-Watch` will output a continous stream of objects from the websocket.
@@ -146,20 +146,20 @@ $somePosts |
146146
---
147147

148148
### Parameters
149-
#### **WebSocketUri**
149+
#### **SocketUrl**
150150
The WebSocket Uri.
151151

152-
|Type |Required|Position|PipelineInput |Aliases |
153-
|-------|--------|--------|---------------------|----------------------------|
154-
|`[Uri]`|false |1 |true (ByPropertyName)|Url<br/>Uri<br/>WebSocketUrl|
152+
|Type |Required|Position|PipelineInput |Aliases |
153+
|-------|--------|--------|---------------------|---------------------------------------------|
154+
|`[Uri]`|false |1 |true (ByPropertyName)|Url<br/>Uri<br/>WebSocketUri<br/>WebSocketUrl|
155155

156156
#### **RootUrl**
157157
One or more root urls.
158158
If these are provided, a WebSocket server will be created with these listener prefixes.
159159

160-
|Type |Required|Position|PipelineInput |Aliases |
161-
|------------|--------|--------|---------------------|---------------------------------------------------------------------------------------------------|
162-
|`[String[]]`|false |2 |true (ByPropertyName)|HostHeader<br/>Host<br/>CNAME<br/>ServerURL<br/>ListenerPrefix<br/>ListenerPrefixes<br/>ListenerUrl|
160+
|Type |Required|Position|PipelineInput |Aliases |
161+
|------------|--------|--------|---------------------|-------------------------------------------------------------------------------------|
162+
|`[String[]]`|true |1 |true (ByPropertyName)|HostHeader<br/>Host<br/>CNAME<br/>ListenerPrefix<br/>ListenerPrefixes<br/>ListenerUrl|
163163

164164
#### **Route**
165165
A route table for all requests.
@@ -179,9 +179,9 @@ This will be displayed when visiting the root url.
179179
#### **PaletteName**
180180
The name of the palette to use. This will include the [4bitcss](https://4bitcss.com) stylesheet.
181181

182-
|Type |Required|Position|PipelineInput|Aliases |
183-
|----------|--------|--------|-------------|----------------------------------------|
184-
|`[String]`|false |named |false |Palette<br/>ColorScheme<br/>ColorPalette|
182+
|Type |Required|Position|PipelineInput |Aliases |
183+
|----------|--------|--------|---------------------|----------------------------------------|
184+
|`[String]`|false |named |true (ByPropertyName)|Palette<br/>ColorScheme<br/>ColorPalette|
185185

186186
#### **GoogleFont**
187187
The [Google Font](https://fonts.google.com/) name.
@@ -214,11 +214,11 @@ A javascript import map. This allows you to import javascript modules.
214214

215215
#### **QueryParameter**
216216
A collection of query parameters.
217-
These will be appended onto the `-WebSocketUri`.
217+
These will be appended onto the `-SocketUrl`.
218218

219-
|Type |Required|Position|PipelineInput|
220-
|---------------|--------|--------|-------------|
221-
|`[IDictionary]`|false |named |false |
219+
|Type |Required|Position|PipelineInput |
220+
|---------------|--------|--------|---------------------|
221+
|`[IDictionary]`|false |named |true (ByPropertyName)|
222222

223223
#### **Handler**
224224
A ScriptBlock that will handle the output of the WebSocket.
@@ -322,9 +322,9 @@ If set, will force a new job to be created, rather than reusing an existing job.
322322
#### **SubProtocol**
323323
The subprotocol used by the websocket. If not provided, this will default to `json`.
324324

325-
|Type |Required|Position|PipelineInput|
326-
|----------|--------|--------|-------------|
327-
|`[String]`|false |named |false |
325+
|Type |Required|Position|PipelineInput |
326+
|----------|--------|--------|---------------------|
327+
|`[String]`|false |named |true (ByPropertyName)|
328328

329329
#### **Filter**
330330
One or more filters to apply to the output of the WebSocket.
@@ -333,18 +333,18 @@ If they are strings or regexes, they will be applied to the raw text.
333333
If they are scriptblocks, they will be applied to the deserialized JSON.
334334
These filters will be run within the WebSocket job.
335335

336-
|Type |Required|Position|PipelineInput|
337-
|--------------|--------|--------|-------------|
338-
|`[PSObject[]]`|false |named |false |
336+
|Type |Required|Position|PipelineInput |
337+
|--------------|--------|--------|---------------------|
338+
|`[PSObject[]]`|false |named |true (ByPropertyName)|
339339

340340
#### **WatchFor**
341341
If set, will watch the output of a WebSocket job for one or more conditions.
342342
The conditions are the keys of the dictionary, and can be a regex, a string, or a scriptblock.
343343
The values of the dictionary are what will happen when a match is found.
344344

345-
|Type |Required|Position|PipelineInput|Aliases |
346-
|---------------|--------|--------|-------------|----------------------|
347-
|`[IDictionary]`|false |named |false |WhereFor<br/>Wherefore|
345+
|Type |Required|Position|PipelineInput |Aliases |
346+
|---------------|--------|--------|---------------------|----------------------|
347+
|`[IDictionary]`|false |named |true (ByPropertyName)|WhereFor<br/>Wherefore|
348348

349349
#### **TimeOut**
350350
The timeout for the WebSocket connection. If this is provided, after the timeout elapsed, the WebSocket will be closed.
@@ -357,9 +357,9 @@ The timeout for the WebSocket connection. If this is provided, after the timeou
357357
If provided, will decorate the objects outputted from a websocket job.
358358
This will only decorate objects converted from JSON.
359359

360-
|Type |Required|Position|PipelineInput|Aliases |
361-
|------------|--------|--------|-------------|---------------------------------------|
362-
|`[String[]]`|false |named |false |PSTypeNames<br/>Decorate<br/>Decoration|
360+
|Type |Required|Position|PipelineInput |Aliases |
361+
|------------|--------|--------|---------------------|---------------------------------------|
362+
|`[String[]]`|false |named |true (ByPropertyName)|PSTypeNames<br/>Decorate<br/>Decoration|
363363

364364
#### **Maximum**
365365
The maximum number of messages to receive before closing the WebSocket.
@@ -379,25 +379,25 @@ The throttle limit used when creating background jobs.
379379
The maximum time to wait for a connection to be established.
380380
By default, this is 7 seconds.
381381

382-
|Type |Required|Position|PipelineInput|
383-
|------------|--------|--------|-------------|
384-
|`[TimeSpan]`|false |named |false |
382+
|Type |Required|Position|PipelineInput |
383+
|------------|--------|--------|---------------------|
384+
|`[TimeSpan]`|false |named |true (ByPropertyName)|
385385

386386
#### **Runspace**
387387
The Runspace where the handler should run.
388388
Runspaces allow you to limit the scope of the handler.
389389

390-
|Type |Required|Position|PipelineInput|
391-
|------------|--------|--------|-------------|
392-
|`[Runspace]`|false |named |false |
390+
|Type |Required|Position|PipelineInput |
391+
|------------|--------|--------|---------------------|
392+
|`[Runspace]`|false |named |true (ByPropertyName)|
393393

394394
#### **RunspacePool**
395395
The RunspacePool where the handler should run.
396396
RunspacePools allow you to limit the scope of the handler to a pool of runspaces.
397397

398-
|Type |Required|Position|PipelineInput|Aliases|
399-
|----------------|--------|--------|-------------|-------|
400-
|`[RunspacePool]`|false |named |false |Pool |
398+
|Type |Required|Position|PipelineInput |Aliases|
399+
|----------------|--------|--------|---------------------|-------|
400+
|`[RunspacePool]`|false |named |true (ByPropertyName)|Pool |
401401

402402
#### **IncludeTotalCount**
403403

@@ -421,5 +421,8 @@ RunspacePools allow you to limit the scope of the handler to a pool of runspaces
421421

422422
### Syntax
423423
```PowerShell
424-
Get-WebSocket [[-WebSocketUri] <Uri>] [[-RootUrl] <String[]>] [-Route <IDictionary>] [-HTML <String>] [-PaletteName <String>] [-GoogleFont <String>] [-CodeFont <String>] [-JavaScript <String[]>] [-ImportMap <IDictionary>] [-QueryParameter <IDictionary>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-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>]
424+
Get-WebSocket [[-SocketUrl] <Uri>] [-QueryParameter <IDictionary>] [-Variable <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-OnConnect <ScriptBlock>] [-OnError <ScriptBlock>] [-OnOutput <ScriptBlock>] [-OnWarning <ScriptBlock>] [-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>]
425+
```
426+
```PowerShell
427+
Get-WebSocket [-RootUrl] <String[]> [-Route <IDictionary>] [-HTML <String>] [-PaletteName <String>] [-GoogleFont <String>] [-CodeFont <String>] [-JavaScript <String[]>] [-ImportMap <IDictionary>] [-Handler <ScriptBlock>] [-Variable <IDictionary>] [-Name <String>] [-InitializationScript <ScriptBlock>] [-BufferSize <Int32>] [-Broadcast <PSObject>] [-Force] [-TimeOut <TimeSpan>] [-Maximum <Int64>] [-ThrottleLimit <Int32>] [-IncludeTotalCount] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]
425428
```

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To stop watching a websocket, simply stop the background job.
4646

4747
~~~powershell
4848
# Create a WebSocket job that connects to a WebSocket and outputs the results.
49-
Get-WebSocket -WebSocketUri "wss://localhost:9669/"
49+
Get-WebSocket -SocketUrl "wss://localhost:9669/"
5050
~~~
5151
#### Get-WebSocket Example 2
5252

docs/_data/Help/Get-WebSocket.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
{
3434
"Title": "EXAMPLE 1",
3535
"Markdown": "Create a WebSocket job that connects to a WebSocket and outputs the results.",
36-
"Code": "Get-WebSocket -WebSocketUri \"wss://localhost:9669/\""
36+
"Code": "Get-WebSocket -SocketUrl \"wss://localhost:9669/\""
3737
},
3838
{
3939
"Title": "EXAMPLE 2",

0 commit comments

Comments
 (0)