Skip to content

Commit e931b53

Browse files
author
James Brundage
committed
feat: Get-WebSocket -NoSubprotocol ( Fixes #83 )
1 parent 4d07b3a commit e931b53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: Commands/Get-WebSocket.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ function Get-WebSocket {
299299
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='WebSocketClient')]
300300
[string]
301301
$SubProtocol,
302+
303+
# If set, will not set a subprotocol. This will only work with certain websocket servers, but will not work with an HTTP Listener WebSocket.
304+
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='WebSocketClient')]
305+
[switch]
306+
$NoSubProtocol,
302307

303308
# One or more filters to apply to the output of the WebSocket.
304309
# These can be strings, regexes, scriptblocks, or commands.
@@ -447,7 +452,7 @@ function Get-WebSocket {
447452
if ($SubProtocol) {
448453
# and add the subprotocol
449454
$ws.Options.AddSubProtocol($SubProtocol)
450-
} else {
455+
} elseif (-not $NoSubProtocol) {
451456
$ws.Options.AddSubProtocol('json')
452457
}
453458
# If there are headers

0 commit comments

Comments
 (0)