Updated websocket ts code

ws factory now creates new object on each invocation instead of reusing
This commit is contained in:
Rohan Sircar 2020-08-09 00:33:00 +05:30
parent 00a01bc81b
commit e4041f9e41

View File

@ -24,14 +24,12 @@ import { ActiveUserViewModel } from "./viewmodel/ActiveUserViewModel";
// log.setLevel("TRACE"); // log.setLevel("TRACE");
const chatSocket = new SockJS("/chat");
const chatStompClient = new Client(); const chatStompClient = new Client();
chatStompClient.webSocketFactory = () => chatSocket; chatStompClient.webSocketFactory = () => new SockJS("/chat");
chatStompClient.activate(); chatStompClient.activate();
const pingSocket = new SockJS("/ping");
const pingStompClient = new Client(); const pingStompClient = new Client();
pingStompClient.webSocketFactory = () => pingSocket; pingStompClient.webSocketFactory = () => new SockJS("/ping");
pingStompClient.activate(); pingStompClient.activate();
pingStompClient.onConnect = () => { pingStompClient.onConnect = () => {