# All messages in chat room

# Notification message event

channel.onNotifyNotice = function(event) {
    // {"nickName":"Kildong Hong","roomId":"e7works","clientKey":"user unique key","message":"message to be sent","mimeType":"text","messageType" :"notice","messageDt":"20200826172223","messageCount":5260,"grade":"user"}
    console.log('onNotifyNotice', event)
};
1
2
3
4
  • Push result value

    Value Identifier Description
    roomId String Channel Key issued after joining CMS
    nickName String The nickname of the user entering the chat room
    clientKey String Unique key for setting the connected terminal that sent the message
    message Date Sent message
    mimeType String message type (text: plain text, emoji: emoji)
    messageType String If it is empty, it is a general message, if it is a notice: "notice"
    messageDt String Send date
    messageCount String Number of chat room messages sent
    grade String Level of the user who sent the message (Check in the User Rating Table )

# Code to be applied to the project

channel.onNotifyNotice = function(event) {
    write(msg,'notice')
}
1
2
3

# New user connection event

channel.onNotifyJoinUser = function(event) {
    // {"roomId":"e7works","clientKey":"4bcdb713","nickName":"edge","grade":"user","joinCount":3476}
    console.log('onNotifyJoinUser', event)
}
1
2
3
4
  • Push result value

    Value Identifier Description
    roomId String Channel Key issued after joining CMS
    nickName String The nickname of the user entering the chat room
    clientKey String Unique key for setting the connected terminal that sent the message
    joinCount String Cumulative number of users
    grade String Level of the user who sent the message (Check in the User Rating Table )

# Code to be applied to the project

channel.onNotifyJoinUser = function(event) {
    write(event,'join')
}
1
2
3

# Event when a new user leaves

channel.onNotifyLeaveUser = function(event) {
    // {"nickName":"edge"}
    console.log('onNotifyLeaveUser', event)
}
1
2
3
4
  • Push result value

    Value Identifier Description
    nickName String The nickname of the user entering the chat room

# Code to be applied to the project

channel.onNotifyLeaveUser = function(event) {
    write(event,'leave')
}
1
2
3

# Deportation event from chat room

channel.onNotifyKickUser = function(event) {
    // {"nickName":"tester_01"}
    console.log('onNotifyKickUser', JSON.stringify(event))
}
1
2
3
4
  • Push result value

    Value Identifier Description
    nickName String The nickname of the user entering the chat room

# Code to be applied to the project

channel.onNotifyKickUser = function(event) {
    write("'<font color='blue'><b>" + event.nickName + "</b></font>' was kicked from the chat room.");
}
1
2
3

# Deportation event from chat room

channel.onNotifyUnkickUser = function(event) {
    // {"clientKey":"5000ec4b","messageDt":1598436375463}
    console.log('onNotifyUnkickUser', JSON.stringify(event))
}
1
2
3
4
  • Push result value

    Value Identifier Description
    clientKey String Unique key for setting the connected terminal that sent the message
    messageDt String Send date

# Code to be applied to the project

channel.onNotifyUnkickUser = function(event) {
    write("'<font color='blue'><b>" + event.nickName + "</b></font>' has been removed from the chat room.");
}
1
2
3

# Writing restriction event in chat room

channel.onNotifyMuteUser = function(event) {
    // {"clientKey":"user unique key","nickName":"Kildong Hong","messageDt":1598426153634}
    console.log('onNotifyMuteUser', JSON.stringify(event))
}
1
2
3
4
  • Push result value

    Value Identifier Description
    nickName String The nickname of the user entering the chat room
    clientKey String Unique key for setting the connected terminal that sent the message
    messageDt String Send date

# Code to be applied to the project

channel.onNotifyMuteUser = function(event) {
    write("'<font color='blue'><b>" + event.nickName + "</b></font>''s writing was restricted.");
}
1
2
3

# Unrestricted writing event in chat room

channel.onNotifyUnmuteUser = function(event) {
    // {"clientKey":"user unique key","nickName":"Kildong Hong","messageDt":1598954317679}
    console.log('onNotifyUnmuteUser', JSON.stringify(event))
}
1
2
3
4
  • Push result value

    Value Identifier Description
    nickName String The nickname of the user entering the chat room
    clientKey String Unique key for setting the connected terminal that sent the message
    messageDt String Send date

# Code to be applied to the project

channel.onNotifyUnmuteUser = function(event) {
    write("'<font color='blue'><b>" + event.nickName + "</b></font>''s writing has been disabled.");
}
1
2
3

# full code

message event full code
// msgInit() part is executed after joinRoom succeeds in login.js
function msgInit() {
    // Notice message
    channel.onNotifyNotice = function(event) {
        write(event,'notice')
    }

    // User position
    channel.onNotifyJoinUser = function(event) {
        write(event,'join')
    }

    // User exit
    channel.onNotifyLeaveUser = function(event) {
        write(event,'leave')
    }

    // expel user
    channel.onNotifyKickUser = function(event) {
        write("'<font color='blue'><b>" + event.nickName + "</b></font>' was kicked from the chat room.");
    }

    // Cancel user expulsion
    channel.onNotifyUnkickUser = function(event) {
        write("'<font color='blue'><b>" + event.nickName + "</b></font>' has been removed from the chat room.");
     }

     // Writing restrictions
     channel.onNotifyMuteUser = function(event) {
         write("'<font color='blue'><b>" + event.nickName + "</b></font>''s writing was restricted.");
     }

     // Release restrictions on writing
     channel.onNotifyUnmuteUser = function(event) {
         write("'<font color='blue'><b>" + event.nickName + "</b></font>''s writing has been disabled.");
     }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Copyright © 2020 | E7Works.Inc & JOYTUNE Corp.