Simple Chat
A minimal IRC-style chat, with join, leave, and message events.
You are .... Open another tab to chat with yourself.
no messages yet...
import { connect } from 'itty-sockets'
const chat = connect('ittysockets.com:demos/chat', {
announce: true,
echo: true,
as: '...',
})
.on('join', ({ alias }) => {
// display the join message
})
.on('leave', ({ alias }) => {
// display the leave message
})
.on('message', ({ alias, text }) => {
// display the message
})
// send a typed message
chat.send({ text: 'hello!' })