WebSockect连接错误

若WebSocket后端出现错误时,WebSockect连接错误则有可能出错:

  1. var ws = new WebSocket("wss://ap.fundebug.com/api/events/count");

Fundebug插件捕获的这个错误之后,开发者将受到报警,然后可以在我们的控制台查看错误详情:

WebSockect 连接错误 - 图1

Fundebug插件捕获的错误数据如下:

  1. {
  2. "notifierVersion": "1.5.1",
  3. "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
  4. "locale": "zh-CN",
  5. "url": "http://localhost:3001",
  6. "title": "TEST",
  7. "releaseStage": null,
  8. "time": 1546522748886,
  9. "type": "websocketError",
  10. "target": {
  11. "type": "onerror",
  12. "url": "wss://ap.fundebug.com/api/events/count",
  13. "timeStamp": 835.6999999959953
  14. }
  15. }

silentWebsocket

如果你不需要监控WebSocket连接错误,则可以将silentWebsocket属性设为true。

  1. if ("fundebug" in window) {
  2. fundebug.silentWebsocket = true;
  3. }