nedois / adonis-chat-demo

Simple demo application that integrates AdonisJS with Socket.IO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adonis chat demo

This repository contains a simple demo application that integrates AdonisJS with Socket.IO, featuring user authentication. The project demonstrates how to set up a basic one-to-one chat application where users can log in, join chat rooms, and exchange messages in real-time.

Features

  • Socket.io singleton server
  • Integration with @adonisjs/auth
  • User authentication (register, login)
  • Groups (create and delete)
  • Group members (list, join, leave, remove)
  • Group messages (list, send)
  • Private messages (list, send)
  • Realtime notifications
  • Inertia+React frontend

WIP

How to

Access the socket.io server:

import Ws from '#services/socket'

const io = Ws.io // singleton instance

Access the current user in the socket context

Ws.io.on('connection', async (socket) => {
  const user = socket.context.auth.getUserOrFail()
  ...
})

About

Simple demo application that integrates AdonisJS with Socket.IO


Languages

Language:TypeScript 98.0%Language:JavaScript 2.0%