角套接字在已部署的版本中不起作用

时间:2018-06-30 09:48:26

标签: angular sockets

我正在使用Angular6和来自'@ stomp / ng2-stompjs'的StompRService;

我的应用程序包含用户和组之间的聊天系统,初始化应用程序后,我请求与服务器建立套接字连接:

public initMessagesSocket() {
    this.stompService.config = {
      url: new SockJS(this.httpService.urlCheck('/secured/ws')),
      headers: {},
      heartbeat_in: 0,
      heartbeat_out: 20000,
      reconnect_delay: 5000,
      debug: true
    };
    this.stompService.initAndConnect();

    const userLogonId = this.loggedInUserInfo.user.logonId;

    const stompSubscription = this.stompService.subscribe('/user/' + userLogonId);

    return stompSubscription;
  }

此代码在本地工作,但是当代码部署在公共服务器上时。我注意到控制台中有一些错误日志,并且使用post方法定期触发奇怪的请求。

这是日志和网络流量的屏幕截图

enter image description here

enter image description here

提前谢谢。

0 个答案:

没有答案