# 새로운 채팅방

새로운 채팅방을 생성하기 위해서는 임의 채팅방에 접속이 되어있어야 가능하다.
반대로 생성한 채팅방도 삭제가 가능하며 동일한 아이디로 삭제를 해야 동작하므로 주의하자. 접속 관련하여 준비가 되지 않았다면 방법을 익히고 오도록 하자 준비사항 바로가기

# 채팅방 생성 이벤트

let openRoomId = "유니크한 룸ID"
privateChannel = vChatCloud.openChannel({
        roomId: openRoomId,
        clientKey: channel.clientKey, // 메인으로 접속한 channel
    },
    function (err, res) {
        console.log(res)
    }
)
1
2
3
4
5
6
7
8
9
  • 푸시 결과 값

    식별자 설명
    err String 오류인 경우 리턴되는 객체
    res String 성공인 경우 리턴되는 객체

# 프로젝트에 적용할 코드

privateChannel = vChatCloud.openChannel({
        roomId: openRoomId,
        clientKey: channel.clientKey,
    },
    function (err, res) {
        if (res) {
            console.log("성공")
        } else if (err) {
            console.log("오류", err)
        }
    }
)
1
2
3
4
5
6
7
8
9
10
11
12

# 채팅방 삭제 이벤트

let openRoomId = "생성한 룸ID"
vChatCloud.closeChannel({
        roomId: openRoomId,
        clientKey: channel.clientKey, // 메인으로 접속한 channel
    },
    function (err, res) {
        console.log(res)
    }
);
1
2
3
4
5
6
7
8
9
  • 푸시 결과 값

    식별자 설명
    err String 오류인 경우 리턴되는 객체
    res String 성공인 경우 리턴되는 객체

# 프로젝트에 적용할 코드

vChatCloud.closeChannel({
        roomId: openRoomId,
        clientKey: channel.clientKey,
    },
    function (err, res) {
        if (res) {
            console.log("성공")
        } else if (err) {
            console.log("오류", err)
        }
    }
);
1
2
3
4
5
6
7
8
9
10
11
12
Copyright 2022. E7Works Inc. & JOYTUNE Corp. All Rights Reserved.