JOIN MY SPONSORS

Connected Users

Connecting with the { announce: true } option broadcasts your identity when you join or leave, displaying your uid and alias in the event. We can use that to track who is on the channel, viewing the same page/resource, etc.

For this example, you are .... New arrivals appear as they join — but viewers already here before you remain only visible as a count until they interact. Open this page in another tab to see the activity.

Current Viewers
+ 1 other
Activity
no activity yet...
viewers.ts
import { connect } from 'itty-sockets'

connect('examples:viewers', {
  announce: true,  // include uid/alias in join/leave events
  as: '...',
})
.on('join', ({ uid, alias, users }) => {
  // a user joined — we know their uid + alias
})
.on('leave', ({ uid, alias, users }) => {
  // a user left
})