客户端使用 websocket连接到 nodejs 托管的多维数据集评估器。
当限制设置为超过 900 时,服务器会因以下错误而崩溃:
// Copyright Joyent, Inc. and other Node contributors.
^
RangeError: Maximum call stack size exceeded
该代码是直接从网站入门指南复制的,即
客户
var socket = new WebSocket("ws://nodeserver/1.0/event/get");
socket.onopen = startReceiving;
function startReceiving() {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
var startDate = yesterday.getTime();
socket.send(JSON.stringify({
"expression": "some_event(param1,param2,param3,param4).eq(param1,'SomeValue')",
"start": startDate,
limit: 20000
}));
socket.send(JSON.stringify({
"expression": "someother_event(param1,param2,param3,param4).eq(param1,'SomeOtherValue')",
"start": startDate,
limit: 20000
}));
}
socket.onmessage = function (message) {
var event = JSON.parse(message.data);
// Do something with event
};
服务器
var cube = require("cube");
var appConfig = require('./server.config.js');
var evaluatorOptions = appConfig.evaluatorOptions;
var registerServer = function(options, cubeSubject) {
var server = cube.server(options);
server.register = function(db, endpoints) {
cubeSubject.register(db, endpoints);
};
server.start();
};
registerServer(evaluatorOptions, cube.evaluator);
谁能建议我在这里做错了什么?