更新fullCalendar whit Socket.io时出错

时间:2018-08-09 22:15:01

标签: javascript node.js express fullcalendar

我有一个日历(fullCalendar.io),在创建/更新事件后,我将其保存在BD中并刷新日历:

function refreshEvent()
{
  $('#calendar').fullCalendar('refetchEvents');
};

我对此没有任何问题。

我实现了socket.io,以刷新所有其他客户端,但是当我运行refreshEvent()

SourceBrowser 中“ 获取事件时出错!

Browser2 中,更新没有问题

$('#calendar').fullCalendar({
      windowResize: function(view) {},
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'agendaWeek'
      },
      allDaySlot: false,scrollTime: '07:00:00',defaultView: 'agendaWeek',
      weekNumbers: true,navLinks: true,editable: true,eventLimit: true,
      droppable: true,
      eventDrop: function(event, delta, revertFunc) {
        var obj = {}
        obj.cAccion = 'M'
        obj.nId = event.id
        obj.cTitle = event.title;
        obj.cStart = assembleFullDate(event.start._i,'start');
        obj.cEnd = assembleFullDate(event.start._i,'end');
        obj.cClassName = selectClass(event.title);
        obj.idEvent = 0;
        var rF = cudObj("/cudEvents",obj);
      },
      eventReceive: function(event) {
        var obj = {}
        obj.cAccion = 'C'
        obj.nId = 0
        obj.cTitle = event.title;
        obj.cStart = assembleFullDate(event.start._i,'start');
        obj.cEnd = assembleFullDate(event.start._i,'end');
        obj.cClassName = selectClass(event.title);
        obj.idEvent = event.id;
        var rF = cudObj("/cudEvents",obj);
      },
      eventSources: [
        {
          url: '/dataSimulation',
          type: 'GET',
          error: function() {
            alert('there was an error while fetching events!');
          }
        }
      ],
      businessHours: {
        dow: [ 1, 2, 3, 4, 5 ],
        start: '07:00',
        end: '18:00',
      },
    });

我知道它会出错,因为它会尝试频繁获取大量数据,并且在以前的数据完成之前无法立即处理。您知道如何解决此问题吗?

0 个答案:

没有答案