LinkUp-P2P-Chat/chatBot/includes/FileMessage.js

26 lines
740 B
JavaScript

class FileMessage {
public FileMessage(peerName, fileName, fileUrl, fileType, peerAvatar, topic, timestamp) {
this.peerName = peerName;
this.fileName = fileName;
this.fileUrl = fileUrl;
this.fileType = fileType;
this.peerAvatar = peerAvatar;
this.topic = topic;
this.timestamp = timestamp;
}
public toJsonString() {
return JSON.stringify({
type: 'file',
name: this.peerName,
fileName: this.fileName,
fileUrl: this.fileUrl,
fileType: this.fileType,
avatar: this.peerAvatar,
topic: this.topic,
timestamp: this.timestamp,
});
}
}
export default FileMessage;