Updated events being sent

This commit is contained in:
Kasper Rynning-Tønnesen
2017-10-17 20:18:58 +02:00
parent f351b6bb99
commit 68a18ef869

View File

@@ -2,36 +2,84 @@
### To server ### To server
``` ```
socket.emit("end", {id: video_id, channel: channel_name}); Tells the server the song is clientside // Tells the server the song is clientside
socket.emit("pos", {channel: channel_name}); Asks server where in the song it should be 'end', {id: video_id, channel: channel_name, pass: channel_pass}
socket.emit('list', CHANNEL_NAME); Tells the server the client wants the list
socket.emit("add", {id: VIDEO_ID, title: VIDEO_TITLE, adminpass: sha256(PASSWORD), duration: VIDEO_DURATION, list: channel_name, playlist: true_if_importing_playlist, num: current_number_of_sending_songs, total: total_number_of_sending_songs}); Sends info about a song the client wants to add // Asks server where in the song it should be
socket.emit("change_channel"); Tells the server to disconnect the user from the current channel, is used for remote controlling on the host side 'pos', {channel: channel_name, pass: channel_pass}
socket.emit("all,chat", TEXT); Sends chat text to all chat
socket.emit("chat", TEXT); Sends chat text to channelchat // Tells the server the client wants the list
socket.emit('vote', {channel: CHANNEL_NAME, id: VIDEO_ID, type: VOTE_TYPE, adminpass: PASSWORD}); Sends info about song the user wants to vote on. If VOTE_TYPE is del, its deleting the song, if its pos, its just voting 'list', {channel: channel_name, pass: channel_pass, version: system_version (now 3)}
socket.emit('skip', {channel: CHANNEL_NAME, adminpass: PASSWORD, id: video_id}); Sends skip message to server
socket.emit("password", {password: PASSWORD, channel: CHANNEL_NAME, oldpass: old_pass_if_changing_password}); Sends password for instant log in to server // Sends info about a song the client wants to add
socket.emit('frontpage_lists'); Tells the server the client wants frontpage lists 'add', {id: VIDEO_ID, title: VIDEO_TITLE, adminpass: sha256(PASSWORD), duration: VIDEO_DURATION, list: channel_name, playlist: true_if_importing_playlist, num: current_number_of_sending_songs, total: total_number_of_sending_songs, pass: channel_pass}
socket.emit("id", {id: CHANNEL_ID, type: "play", value: "mock"}); Sends message to the host channel for play
socket.emit("id", {id: CHANNEL_ID, type: "pause", value: "mock"}); Sends message to the host channel for pause // Tells the server to disconnect the user from the current channel, is used for remote controlling on the host side
socket.emit("id", {id: CHANNEL_ID, type: "skip", value: "mock"}); Sends message to the host channel for skip 'change_channel', {channel: channel_name}
socket.emit("id", {id: CHANNEL_ID, type: "volume", value: VALUE}); Sends message to the host channel to change volume
socket.emit("id", {id: CHANNEL_ID, type: "channel", value: NEW_CHANNEL_NAME}); Sends message to the host channel to change channel // Sends chat text to all chat
'all,chat', {channel: channel_name, data: input}
// Sends chat text to channelchat
'chat',{channel: channel_name, data: input, pass: channel_pass}
// Sends info about song the user wants to vote on. If VOTE_TYPE is del, its deleting the song, if its pos, its just voting
'vote', {channel: CHANNEL_NAME, id: VIDEO_ID, type: VOTE_TYPE, adminpass: PASSWORD}
// Sends skip message to server
'skip', {pass: adminpass, id:video_id, channel: chan, userpass: channel_pass}
// Sends password for instant log in to server
'password', {password: PASSWORD, channel: CHANNEL_NAME, oldpass: old_pass_if_changing_password}
// Sends message to the host channel for play
'id', {id: CHANNEL_ID, type: "play", value: "mock"}
// Sends message to the host channel for pause
'id', {id: CHANNEL_ID, type: "pause", value: "mock"}
// Sends message to the host channel for skip
'id', {id: CHANNEL_ID, type: "skip", value: "mock"}
// Sends message to the host channel to change volume
'id', {id: CHANNEL_ID, type: "volume", value: VALUE}
// Sends message to the host channel to change channel
'id', {id: CHANNEL_ID, type: "channel", value: NEW_CHANNEL_NAME}
``` ```
### From server ### From server
``` ```
socket.on("toast", STRING) Recieves a string from server for what type of toast to be triggered // Recieves a string from server for what type of toast to be triggered
socket.on("pw", STRING) Recieves the password for the channel if the user sent the right in the first place 'toast', STRING
socket.on("conf", [ARRAY]) Recieves configuration array from server
socket.on("chat.all", {from: CLIENT_NAME, msg: STRING, channel: CLIENT_CHANNEL_NAME}) Recieves chat message from allchat // Recieves the password for the channel if the user sent the right in the first place
socket.on("chat", {from: CLIENT_NAME, msg: STRING}) Recieves chat message from channelchat 'pw', STRING
socket.on("id", STRING) Recieves the ID of the current client, used for remote listening
socket.on(id, {type: STRING, value: VALUE}) Recieves the messages sent on CHANNEL_ID above // Recieves configuration array from server
socket.on("channel", {type: TYPE, value: value, time: time_of_occurence}) Recieves updates from channel. type is one of the following: list, added, deleted, vote, song_change 'conf', [ARRAY]
socket.on("get_list") Recieves message from the server that its ready to send the playlist and info
socket.on('playlists', {channels: array, viewers: number}) Recieves the playlists for the frontpage // Recieves chat message from allchat
socket.on("np", {np: NOW_PLAYING, conf: CONFIGURATION, time: SERVER_TIME}) Recieves array of now playing song. Is triggered on song-change 'chat.all', {from: name, msg: message, channel: channel, icon: icon_src}
socket.on("viewers", VALUE) Recieves number of viewers on the current channel
// Recieves chat message from channelchat
'chat', {from: name, msg: message, icon: icon_src}
// Recieves the ID of the current client, used for remote listening
'id', STRING
// Recieves the messages sent on CHANNEL_ID above
id, {type: STRING, value: VALUE}
// Recieves updates from channel. type is one of the following: list, added, deleted, vote, song_change
'channel', {type: TYPE, value: value, time: time_of_occurence}
// Recieves message from the server that its ready to send the playlist and info
'get_list'
// Recieves array of now playing song. Is triggered on song-change
'np', {np: NOW_PLAYING, conf: CONFIGURATION, time: SERVER_TIME}
// Recieves number of viewers on the current channel
'viewers', VALUE
``` ```