개인 메시지
해당 이벤트는 중복 로그인, 글쓰기 제한 등 사용자에게 바로 전달되는 이벤트이며 다른 사용자에게는 전달되지 않습니다.
중복 로그인시 이벤트
ClientKey가 중복되어 로그인이 중복으로 이루어질 경우 기존 사용자에게 전달되는 이벤트입니다.
js
channel.onPersonalDuplicateUser = function (event) {
// {"clientKey":"user고유키","messageDt":1598438072058}
console.log("onNotifyMuteUser", event);
};
1
2
3
4
2
3
4
푸시 결과 값
값 식별자 설명 clientKey String 접속 단말 설정 고유키 messageDt Number 전송 날짜 (epoch time)
프로젝트에 적용할 코드
js
channel.onPersonalDuplicateUser = function (event) {
vChatCloud.disconnect();
openError("중복 로그인으로 인해 로그아웃합니다.", function () {
$("div.enterypopup").show();
$("div.chat_field").hide();
});
};
1
2
3
4
5
6
7
2
3
4
5
6
7
글쓰기 제한 이벤트
js
channel.onPersonalMuteUser = function (event) {
// {"clientKey":"user고유키","nickName":"홍길동","messageDt":1598438218334}
console.log("onNotifyMuteUser", event);
};
1
2
3
4
2
3
4
푸시 결과 값
값 식별자 설명 clientKey String 접속 단말 설정 고유키 nickName String 채팅방 입장 유저의 별명 messageDt Number 전송 날짜 (epoch time)
프로젝트에 적용할 코드
js
channel.onPersonalMuteUser = function (event) {
openError("글쓰기가 제한되었습니다.");
};
1
2
3
2
3
글쓰기 제한 해제 이벤트
js
channel.onPersonalUnmuteUser = function (event) {
// {"clientKey":"user고유키","nickName":"홍길동","messageDt":1598438225886}
console.log("onNotifyMuteUser", event);
};
1
2
3
4
2
3
4
푸시 결과 값
값 식별자 설명 clientKey String 접속 단말 설정 고유키 nickName String 채팅방 입장 유저의 별명 messageDt Number 전송 날짜 (epoch time)
프로젝트에 적용할 코드
js
channel.onPersonalUnmuteUser = function (event) {
openError("글쓰기 제한이 해제되었습니다.");
};
1
2
3
2
3
전체 코드
메시지 이벤트 전체코드
js
// personalInit() 부분은 login.js에 joinRoom 이 성공한 이후에 실행
function personalInit() {
// 중복 로그인시 이벤트
channel.onPersonalDuplicateUser = function (event) {
vChatCloud.disconnect();
openError("중복 로그인으로 인해 로그아웃합니다.", function () {
$("div.enterypopup").show();
$("div.chat_field").hide();
});
};
// 글쓰기 제한 이벤트
channel.onPersonalMuteUser = function (event) {
openError("글쓰기가 제한되었습니다.");
};
// 글쓰기 제한 해제 이벤트
channel.onPersonalUnmuteUser = function (event) {
openError("글쓰기 제한이 해제되었습니다.");
};
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21