Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getWebsocketConfig(): StompConfig {
const stompConfig = new StompConfig();
stompConfig.url = () => new SockJS(WebsocketService.baseWsEndpoint);
stompConfig.heartbeat_in = 0;
stompConfig.heartbeat_out = 20000;
stompConfig.reconnect_delay = 1000;
stompConfig.debug = true;
return stompConfig;
}
getWebsocketConfig(): StompConfig {
const stompConfig = new StompConfig();
stompConfig.url = () => new SockJS(baseWsEndpoint);
stompConfig.heartbeat_in = 0;
stompConfig.heartbeat_out = 20000;
stompConfig.reconnect_delay = 1000;
stompConfig.debug = true;
return stompConfig;
}
connectStompService(config: any) {
const stompUrl = config.protocol + '://' + config.host + ':' + config.port + config.endpoint;
const stompConfig: StompConfig = {
url: stompUrl,
headers: {
login: '',
passcode: ''
},
heartbeat_in: 0,
heartbeat_out: 20000,
reconnect_delay: 5000,
debug: true
};
this.stompService = new StompService(stompConfig);
this.stompService.subscribe(config.likesTopic).subscribe(like => this.likes.unshift(JSON.parse(like.body)));
}