Skip to content

Commit

Permalink
feat: Get-WebSocket -PSTypeName ( Fixes #34 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Dec 7, 2024
1 parent b53081d commit 8c1c4de
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Commands/Get-WebSocket.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ function Get-WebSocket {
[TimeSpan]
$TimeOut,

# If provided, will decorate the objects outputted from a websocket job.
# This will only decorate objects converted from JSON.
[Alias('PSTypeNames','Decorate','Decoration')]
[string[]]
$PSTypeName,

# The maximum number of messages to receive before closing the WebSocket.
[long]
$Maximum,
Expand Down Expand Up @@ -256,6 +262,13 @@ function Get-WebSocket {
if ([string]::IsNullOrWhitespace($JS)) { continue }
ConvertFrom-Json $JS
}
if ($PSTypeName) {
$webSocketMessage.pstypenames.clear()
[Array]::Reverse($PSTypeName)
foreach ($psType in $psTypeName) {
$webSocketMessage.pstypenames.add($psType)
}
}
if ($handler) {
$psCmd =
if ($runspace.LanguageMode -eq 'NoLanguage' -or
Expand Down

0 comments on commit 8c1c4de

Please sign in to comment.