1
1
<div align =' center ' >
2
- <img alt='WebSocket Logo (Animated)' style='height:50 %' src='Assets/WebSocket-Animated.svg' />
2
+ <img alt='WebSocket Logo (Animated)' style='width:33 %' src='Assets/WebSocket-Animated.svg' />
3
3
</div >
4
4
5
5
# WebSocket
@@ -46,17 +46,40 @@ To stop watching a websocket, simply stop the background job.
46
46
47
47
~~~ powershell
48
48
# Create a WebSocket job that connects to a WebSocket and outputs the results.
49
- Get-WebSocket -WebSocketUri "wss://localhost:9669"
49
+ Get-WebSocket -WebSocketUri "wss://localhost:9669/ "
50
50
~~~
51
51
#### Get-WebSocket Example 2
52
52
53
53
~~~ powershell
54
54
# Get is the default verb, so we can just say WebSocket.
55
- websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post
55
+ # `-Watch` will output a continous stream of objects from the websocket.
56
+ # For example, let's Watch BlueSky, but just the text.
57
+ websocket wss://jetstream2.us-west.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Watch |
58
+ % {
59
+ $_.commit.record.text
60
+ }
56
61
~~~
57
62
#### Get-WebSocket Example 3
58
63
59
64
~~~ powershell
65
+ # Watch BlueSky, but just the text and spacing
66
+ $blueSkySocketUrl = "wss://jetstream2.us-$(
67
+ 'east','west'|Get-Random
68
+ ).bsky.network/subscribe?$(@(
69
+ "wantedCollections=app.bsky.feed.post"
70
+ ) -join '&')"
71
+ websocket $blueSkySocketUrl -Watch |
72
+ % { Write-Host "$(' ' * (Get-Random -Max 10))$($_.commit.record.text)$($(' ' * (Get-Random -Max 10)))"}
73
+ ~~~
74
+ #### Get-WebSocket Example 4
75
+
76
+ ~~~ powershell
77
+ websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post
78
+ ~~~
79
+ #### Get-WebSocket Example 5
80
+
81
+ ~~~ powershell
82
+ # Watch BlueSky, but just the emoji
60
83
websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail |
61
84
Foreach-Object {
62
85
$in = $_
@@ -65,11 +88,11 @@ websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.f
65
88
}
66
89
}
67
90
~~~
68
- #### Get-WebSocket Example 4
91
+ #### Get-WebSocket Example 6
69
92
70
93
~~~ powershell
71
94
$emojiPattern = '[\p{IsHighSurrogates}\p{IsLowSurrogates}\p{IsVariationSelectors}\p{IsCombiningHalfMarks}]+)'
72
- websocket jetstream2.us-east .bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail |
95
+ websocket wss:// jetstream2.us-west .bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Tail |
73
96
Foreach-Object {
74
97
$in = $_
75
98
$spacing = (' ' * (Get-Random -Minimum 0 -Maximum 7))
@@ -79,7 +102,7 @@ websocket jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.f
79
102
}
80
103
}
81
104
~~~
82
- #### Get-WebSocket Example 5
105
+ #### Get-WebSocket Example 7
83
106
84
107
~~~ powershell
85
108
websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post -Watch |
@@ -90,8 +113,3 @@ websocket wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.
90
113
$_.commit.record.embed.external.uri
91
114
}
92
115
~~~
93
- #### Get-WebSocket Example 6
94
-
95
- ~~~ powershell
96
-
97
- ~~~
0 commit comments