Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active May 6, 2017
Embed
What would you like to do?
RxJS Socket.IO Angular Chat - Angular Component - Coding Blast - www.codingblast.com
ngOnInit() {
this.chatService
.getMessages()
.throttleTime(1000)
.subscribe((message: string) => {
let currentTime = moment().format('hh:mm:ss a');
let messageWithTimestamp = `${currentTime}: ${message}`;
this.messages.push(messageWithTimestamp);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment