File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ function Get-WebSocket {
18
18
# Create a WebSocket job that connects to a WebSocket and outputs the results.
19
19
$socketServer = Get-WebSocket -RootUrl "http://localhost:8387/" -HTML "<h1>WebSocket Server</h1>"
20
20
$socketClient = Get-WebSocket -SocketUrl "ws://localhost:8387/"
21
+ foreach ($n in 1..10) { $socketServer.Send(@{n=Get-Random}) }
22
+ $socketClient | Receive-Job -Keep
21
23
. EXAMPLE
22
24
# Get is the default verb, so we can just say WebSocket.
23
25
# `-Watch` will output a continous stream of objects from the websocket.
@@ -918,7 +920,7 @@ function Get-WebSocket {
918
920
# If the request is a websocket request
919
921
if ($Request.IsWebSocketRequest ) {
920
922
# we will change the event identifier to a websocket scheme.
921
- $eventIdentifier = $eventIdentifier -replace ' ^http' , ' ws'
923
+ $eventIdentifier = $eventIdentifier -replace ' ^http' , ' ws'
922
924
# and call the `AcceptWebSocketAsync` method to upgrade the connection.
923
925
$acceptWebSocket = $context.AcceptWebSocketAsync (' json' )
924
926
# Once again, we'll use a tight loop to wait for the upgrade to complete or fail.
You can’t perform that action at this time.
0 commit comments