Chat

chatting room API

create room

POST /api/chat/room/create

๋ฐฉ์ด ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•˜๊ณ , ์—†๋‹ค๋ฉด ๋งŒ๋“ค๊ณ , ์žˆ๋‹ค๋ฉด ๊ทธ ๋ฐฉ์˜ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. identifier๋Š” ๋ฐฉ์˜ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. 1:1 ์ฑ„ํŒ… ์‹œ "my_id - friend_id ๋˜๋Š” friend_id - my_id"๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ๋‚˜์™€ ์นœ๊ตฌ์˜ ID ์ค‘ ๋” ์ž‘์€ ์ชฝ์ด -์˜ ์•ž์ชฝ์— ๋‚˜ํƒ€๋‚˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ex) my_id = 2, friend_id = 1 ์ผ ๋•Œ , identifier = "1-2" participant๋Š” ๋ฐฉ์— ๋“ค์–ด๊ฐ€ ์žˆ๋Š” user๋“ค์˜ id์˜ array์ž…๋‹ˆ๋‹ค.

Request Body

Name
Type
Description

my_id

number

1

type

string

"individual" || "group"

room_name

string

"์นœ๊ตฌ ์ด๋ฆ„"

identifier

string

"1-2"

participant

array

[ 1, 2 ]

{
    {
        room_id: 1,
        identifier: "1-2",
        type: "individual",
        room_name: "",
        last_chat: "",
        not_read_chat: 0,
        last_read_chat_id: 0,
        updatedAt: 2020-10-08T10:20:13.000Z,
    },
    msg: "์ฑ„ํŒ…๋ฐฉ์ด ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค."
}

get chat of the room.

GET /api/chat/room?room_id=1&cursor=

cursor์€ chatting์„ ๋ถˆ๋Ÿฌ์˜ฌ ๊ธฐ์ค€์ ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. cursor์„ ๊ธฐ์ค€์œผ๋กœ chatting์˜ id๊ฐ€ cursor๋ณด๋‹ค ์ž‘์€ ์ฑ„ํŒ…์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. limit = 15๋กœ ์„ค์ •ํ–ˆ์œผ๋ฏ€๋กœ, ์ฑ„ํŒ…์€ 15๊ฐœ์”ฉ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์ฑ„ํŒ…๋ฐฉ์— ์ฑ„ํŒ…์˜ id๊ฐ€ 1~30์ด๊ณ , cursor์ด 5๋ผ๋ฉด id๊ฐ€ 6~20์ธ ์ฑ„ํŒ…์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Query Parameters

Name
Type
Description

room_id

number

1

cursor

number

9999999999

{
    "data": [
            {"id":507,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
            {"id":508,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
            {"id":509,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
            {"id":510,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
            {"id":511,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
            {"id":512,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
            {"id":513,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
            {"id":514,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
            {"id":518,"room_id":1,"send_user_id":1,"message":"๊พธ๋ฃจ๋ฃฐ๋ฃจ๋ฃจ๋ฃจ","not_read":0,"createdAt":"2020-10-08T14:14:07.000Z"},
            {"id":544,"room_id":1,"send_user_id":2,"message":"011","not_read":0,"createdAt":"2020-10-09T05:43:21.000Z"},
            {"id":545,"room_id":1,"send_user_id":2,"message":"\n\n\nddas\n\n\n\nใ…‡ใ…‡ใ„ดใ…ใ…‡ใ…ใ„ด\n\n\nใ…‡ใ…‡","not_read":0,"createdAt":"2020-10-09T05:43:26.000Z"},
            {"id":546,"room_id":1,"send_user_id":2,"message":"ใ…ใ…‡ใ…ใ…‡ใ„ดใ…ใ…‡\n\nใ…‡ใ„ดใ…","not_read":0,"createdAt":"2020-10-09T05:43:30.000Z"},
            {"id":551,"room_id":1,"send_user_id":1,"message":"ใ…Žใ…‡","not_read":1,"createdAt":"2020-10-10T02:44:50.000Z"},
            {"id":552,"room_id":1,"send_user_id":1,"message":"ใ…Žใ…‡","not_read":1,"createdAt":"2020-10-10T02:44:51.000Z"},
            {"id":553,"room_id":1,"send_user_id":1,"message":"ใ…Žใ…‡","not_read":1,"createdAt":"2020-10-10T02:44:51.000Z"}
    ],
    "msg":"์ฑ„ํŒ… ๋ชฉ๋ก์„ ๋ถˆ๋Ÿฌ์™”์Šต๋‹ˆ๋‹ค."
}

get my room list

GET /api/chat/roomList/:user_id

Path Parameters

Name
Type
Description

user_id

number

1

{
    "data":[
        {"room_id":1,"room_name":"","type":"individual","identifier":"1-2","participant":[1],"last_chat":"ใ…Žใ…‡","not_read_chat":0,"last_read_chat_id":558,"updatedAt":"2020-10-10T12:25:57.000Z"},
        {"room_id":4,"room_name":"","type":"individual","identifier":"2-4","participant":[4],"last_chat":"์•„!!","not_read_chat":0,"last_read_chat_id":429,"updatedAt":"2020-10-08T10:12:12.000Z"},
        {"room_id":6,"room_name":"","type":"individual","identifier":"2-8","participant":[8],"last_chat":"dsa","not_read_chat":6,"last_read_chat_id":0,"updatedAt":"2020-10-08T10:12:56.000Z"},
        {"room_id":12,"room_name":"","type":"individual","identifier":"2-2","participant":[2],"last_chat":"๋ฉ”์‹œ์ง€","not_read_chat":0,"last_read_chat_id":557,"updatedAt":"2020-10-10T12:25:51.000Z"}
    ],
    "msg":"์ฑ„ํŒ…๋ฐฉ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ด"
}

Last updated

Was this helpful?