Created
February 7, 2019 07:32
-
-
Save BMLande/236d2bd5b7bbec6d76fb6a49d3c3da8f to your computer and use it in GitHub Desktop.
Websocket Service
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 { Injectable } from '@angular/core'; | |
import * as Stomp from 'stompjs'; | |
import * as SockJS from 'sockjs-client'; | |
@Injectable({ providedIn: 'root' }) | |
export class WebSocketService { | |
//connect to websocket server | |
public connect() { | |
let socket = new SockJS("http://192.168.1.9:8080/websocketapp"); | |
let stompClient = Stomp.over(socket); | |
return stompClient; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment