@blinkdotnew/sdk 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -78,8 +78,10 @@ const unsubscribe = await blink.realtime.subscribe('chat-room', (message) => {
78
78
 
79
79
  await blink.realtime.publish('chat-room', 'message', { text: 'Hello world!' })
80
80
 
81
+ // Get presence returns an array of PresenceUser objects directly
81
82
  const users = await blink.realtime.presence('chat-room')
82
83
  console.log('Online users:', users.length)
84
+ // users is PresenceUser[] - e.g., [{ userId: 'abc123', metadata: { displayName: 'Alice' } }]
83
85
 
84
86
  // Analytics operations (automatic pageview tracking + custom events)
85
87
  // Pageviews are tracked automatically on initialization and route changes
@@ -819,6 +821,7 @@ const unsubMessage = channel.onMessage((message) => {
819
821
  })
820
822
 
821
823
  // Listen for presence changes (who's online)
824
+ // The callback receives an array of PresenceUser objects
822
825
  const unsubPresence = channel.onPresence((users) => {
823
826
  console.log(`${users.length} users online:`)
824
827
  users.forEach(user => {
@@ -833,8 +836,11 @@ await channel.publish('game-move', { x: 5, y: 3, piece: 'king' })
833
836
  await channel.publish('typing', { isTyping: true })
834
837
 
835
838
  // Get current presence (one-time check)
839
+ // Returns an array of PresenceUser objects directly
836
840
  const currentUsers = await channel.getPresence()
837
841
  console.log('Currently online:', currentUsers.length)
842
+ // currentUsers is PresenceUser[] with format:
843
+ // [{ userId: 'user123', metadata: { displayName: 'John', status: 'online' } }, ...]
838
844
 
839
845
  // Get message history
840
846
  const recentMessages = await channel.getMessages({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/sdk",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",