Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/safakb/socketio-chat

Socket.IO Chat with NodeJS + Mysql (Room Supported)
https://github.com/safakb/socketio-chat

html mysql node node-js socket socket-io

Last synced: about 1 month ago
JSON representation

Socket.IO Chat with NodeJS + Mysql (Room Supported)

Awesome Lists containing this project

README

        

# NodeJS socket.io Chat (Mysql Supported)
[![NPM version](https://badge.fury.io/js/socketio-chat.svg)](https://www.npmjs.com/package/socket.io)
![Downloads](https://img.shields.io/npm/dm/socketio-chat.svg?style=flat)

![image](https://github.com/user-attachments/assets/007bd8b6-ef48-4a8b-a86f-daa21e7214ce)

![image](https://github.com/user-attachments/assets/36e9dfef-717a-4b77-92f5-79703995a781)

Using NodeJS with socket.io
Creating server and client with socket connection
Mysql Supported

## ๐Ÿšจ Important
~~`token`~~ and `password`(md5) hashes not safety

## ๐Ÿ”ฅ Features

- Register
- Login
- Rooms
- Users
- Get online users list and count
- Connect / Disconnect
- Send Message

## ๐Ÿ“ API Endpoints
| Action | Url | Request + Header |
| ------ | ------ | ------ |
| ๐ŸŸ  Login | /login | `{ "username" : "","password" : "" }` |
| ๐ŸŸ  Register | /register | `{"username" : "","nickname" :"","password" : "" }` |
| ๐ŸŸ  Logout | /logout | `{ "token": "" }` |
| ๐ŸŸ  Check Token | /check-token | `{ "token": "" }` |
| ๐ŸŸข Get Rooms | /rooms | `header: { "Authorization": "Bearer " }` |
| ๐ŸŸข Room Messages | /room-messages/:id | `header: { "Authorization": "Bearer " }` |
| ๐ŸŸ  Send Message to Room | /room-messages/:id | `{ "message": "" }` `header: { "Authorization": "Bearer " }` |

### ๐Ÿ“‹ Before
- Create database
- Import database `exampledb.sql`
- Set `.env.example` and rename `.env`

### ๐Ÿ Start NodeJS Server

```bash
npm install
node app.js
```

### ๐Ÿ”— Go URL
`http://localhost:3001/index.html`

### ๐Ÿงช Test User
User : `test`
Password : `123456`

## ๐ŸŽฏ Roadmap

- Enabled Https server with certificate
- ~~Token change JWT~~
- ~~Fix multiple tab login~~
- Add new room messages counts
- Room message convert socket io `to` method

#### Credits

- Used [UI](https://codepen.io/ThomasDaubenton/pen/QMqaBN)