Skip to content

dnjscksdn98/spring-redis-chat-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Chat Server using Redis Pub/Sub, WebSockets, and Spring Boot

Run Docker

docker run -d -p 6379:6379 -v /data --name redis redis
docker run -d -p 8080:8080 --name chat-server dnjscksdn98/websocket-chat:1.0.2

Run in localhost

docker run -d -p 8080:8080 --name chat-server dnjscksdn98/websocket-chat:1.0.2-beta

🚀 API Documentation

✓ Connecting to WebSockets

ws://{domainAddress}:8080/ws/chat

✓ Publish path

/pub/chat/message

✓ Subscribe path

/sub/chat/room/{chatRoomId}

✓ Create Chat Room

POST /chat

Attribute Type Required Description
name string yes Chat Room Name

Example Response

{
    "id": 1,
    "name": "yapp 17th"
}

✓ Retrieve Chat Rooms

GET /chat

Example Response

[
    {
        "id": 1,
        "name": "yapp 17th"
    },
    {
        "id": 2,
        "name": "marketing team"
    }
]

✓ Retreive Chat Messages from Chat Room

GET /chat/{chatRoomId}

Example Response

[
    {
        "chatRoomId": 1,
        "sender": "tester",
        "message": "hello",
        "messageType": "TALK"
    },
    {
        "chatRoomId": 1,
        "sender": "tester",
        "message": "bye",
        "messageType": "TALK"
    }
]