JOIN MY SPONSORS

Simple Chat

A minimal IRC-style chat, with join, leave, and message events.

In this window, you are .... To chat with yourself, open this page in another tab.

no messages yet...
chat.ts
import { connect } from 'itty-sockets'

const chat = connect('examples:simple-chat', {
  announce: true,  // include uid/alias in join/leave events
  echo: true,      // receive your own messages back
  as: '...',
})
.on('join', ({ alias, users }) => {
  // display the join message
})
.on('leave', ({ alias, users }) => {
  // display the leave message
})
.on('message', ({ alias, text }) => {
  // display the message
})

// send a typed message
chat.send({ text: 'hello!' })