Created
May 5, 2017 06:36
-
-
Save Ibro/f9da06e580b0d96b2093e32764a61a26 to your computer and use it in GitHub Desktop.
RxJS Socket.IO Angular Chat - Angular Service - Coding Blast - www.codingblast.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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