Skip to content

Instantly share code, notes, and snippets.

@Ibro
Created May 5, 2017 06:36
Show Gist options
  • Save Ibro/f9da06e580b0d96b2093e32764a61a26 to your computer and use it in GitHub Desktop.
Save Ibro/f9da06e580b0d96b2093e32764a61a26 to your computer and use it in GitHub Desktop.
RxJS Socket.IO Angular Chat - Angular Service - Coding Blast - www.codingblast.com
import * as io from 'socket.io-client';
export class ChatService {
private url = 'http://localhost:3000';
private socket;
constructor() {
this.socket = io(this.url);
}
public sendMessage(message) {
this.socket.emit('new-message', message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment