Skip to content

Commit 8c1c4de

Browse files
author
James Brundage
committed
feat: Get-WebSocket -PSTypeName ( Fixes #34 )
1 parent b53081d commit 8c1c4de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Commands/Get-WebSocket.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ function Get-WebSocket {
173173
[TimeSpan]
174174
$TimeOut,
175175

176+
# If provided, will decorate the objects outputted from a websocket job.
177+
# This will only decorate objects converted from JSON.
178+
[Alias('PSTypeNames','Decorate','Decoration')]
179+
[string[]]
180+
$PSTypeName,
181+
176182
# The maximum number of messages to receive before closing the WebSocket.
177183
[long]
178184
$Maximum,
@@ -256,6 +262,13 @@ function Get-WebSocket {
256262
if ([string]::IsNullOrWhitespace($JS)) { continue }
257263
ConvertFrom-Json $JS
258264
}
265+
if ($PSTypeName) {
266+
$webSocketMessage.pstypenames.clear()
267+
[Array]::Reverse($PSTypeName)
268+
foreach ($psType in $psTypeName) {
269+
$webSocketMessage.pstypenames.add($psType)
270+
}
271+
}
259272
if ($handler) {
260273
$psCmd =
261274
if ($runspace.LanguageMode -eq 'NoLanguage' -or

0 commit comments

Comments
 (0)