File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ function Get-WebSocket {
1818 # Create a WebSocket job that connects to a WebSocket and outputs the results.
1919 $socketServer = Get-WebSocket -RootUrl "http://localhost:8387/" -HTML "<h1>WebSocket Server</h1>"
2020 $socketClient = Get-WebSocket -SocketUrl "ws://localhost:8387/"
21+ foreach ($n in 1..10) { $socketServer.Send(@{n=Get-Random}) }
22+ $socketClient | Receive-Job -Keep
2123 . EXAMPLE
2224 # Get is the default verb, so we can just say WebSocket.
2325 # `-Watch` will output a continous stream of objects from the websocket.
@@ -918,7 +920,7 @@ function Get-WebSocket {
918920 # If the request is a websocket request
919921 if ($Request.IsWebSocketRequest ) {
920922 # we will change the event identifier to a websocket scheme.
921- $eventIdentifier = $eventIdentifier -replace ' ^http' , ' ws'
923+ $eventIdentifier = $eventIdentifier -replace ' ^http' , ' ws'
922924 # and call the `AcceptWebSocketAsync` method to upgrade the connection.
923925 $acceptWebSocket = $context.AcceptWebSocketAsync (' json' )
924926 # 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