Tag: socket.io

使用node.js v0.6.18安装socket.io。 ws在安装过程中失败

我想安装一个beaglebone上的npm使用socket.io(linux埃) /> npm安装socket.io 它在较老的内核版本的旧版本上运行良好。 我正在使用节点v0.6.18。 当npm tring安装应该用socket.io安装的ws时,似乎有一个问题 我遇到同样的错误,如果我尝试: npm install ws –ws:verbose 结果如下: root@beaglebone:~# npm install ws –ws:verbose npm http GET https://registry.npmjs.org/ws npm http 304 https://registry.npmjs.org/ws npm http GET https://registry.npmjs.org/commander npm http GET https://registry.npmjs.org/tinycolor npm http GET https://registry.npmjs.org/options npm http 304 https://registry.npmjs.org/commander npm http 304 https://registry.npmjs.org/tinycolor npm http 304 https://registry.npmjs.org/options > ws@0.4.18 install /home/root/node_modules/ws > […]

需要一些帮助理解nodejs和socket.io

对不起,这个问题相当无知,但是我对这两种技术有点困惑。 我在C#中编写了一个使用Fleck的networking服务器,并且一切正常,但是我意识到我可能找不到可以运行.NET应用程序的托pipe提供程序。 我想使用websockets,我发现socket.io是非常受欢迎,但我不确定它是什么。 纠正我,如果我错了,但是,它就像写一个服务器在JavaScript中,并运行与node.exe应用程序的JavaScript文件,然后服务器正在运行? 人们如何find提供这种服务的托pipe服务提供商? 最后,socket.io只是nodejs的扩展吗? 当你使用socket.io时,你必须在javascript中编写你的服务器吗? 再次,对于新手的问题感到抱歉,但我只是想在继续之前了解一些基本的东西。 谢谢。

在node.js中打开套接字时发送数据

我正在configuration一个nodejs服务器,以便将其用作推送通知的服务器。 我有这个代码: io.sockets.on('connection', function(socket) { console.log(socket); // watching the xml file fs.watchFile('client.xml', function(curr, prev) { // on file change we can read the new xml fs.readFile('client.xml', function(err, data) { if (err) throw err; // parsing the new xml datas and converting them into json file parser.parseString(data); }); }); // when the parser ends the parsing […]

node.js和socket.io – 广播是未定义的

使用Node.js和socket.io,下面的工作正常,试图广播回客户端。 我正在播放未定义? var http = require('http'), sys = require('sys'), fs = require('fs'), io = require('socket.io'); var server = http.createServer(function(request, response) { response.writeHead(200, { 'Content-Type': 'text/html' }); var rs = fs.createReadStream(__dirname + '/index.html'); sys.pump(rs, response); }); var socket = io.listen(server); debugger; socket.on('connection', function(client) { debugger; var username; client.send('Welcome to this socket.io chat server!'); client.send('Please input your […]

canvas与国际象棋的DOM的

我正在创build一个HTML 5国际象棋游戏。 服务器端是socket.io / node.js / backbone.js。 我现在开始写游戏板的视图。 在canvas或DOM元素(又名div)中代表棋盘会更容易吗? 忽略浏览器兼容性。

Socket.io失败并出现内部错误

我最近运行了npm install,它更新了我所有的软件包。 由于某种原因,这打破了我的networking服务器(每当我尝试加载一个页面,它只会加载部分的方式和死亡这个错误)。 我试着回滚版本的socket.io,redis和nodetime,它们是堆栈跟踪中显示的软件包,但是我没有让web服务器再次运行。 帮帮我? 我在OS X上运行。 events.js:66 throw arguments[1]; // Unhandled 'error' event ^ TypeError: First argument must be a Buffer at RedisClient.message (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/lib/stores/redis.js:126:24) at RedisClient.EventEmitter.emit (events.js:115:20) at RedisClient.return_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:440:22) at RedisReplyParser.<anonymous> (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:81:14) at RedisReplyParser.EventEmitter.emit (events.js:88:17) at RedisReplyParser.add_multi_bulk_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:311:14) at RedisReplyParser.send_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:272:18) at RedisReplyParser.execute (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:222:22) at RedisClient.on_data (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:358:27) at Socket.<anonymous> (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:93:14)

Sockets.io生成错误,致命错误c1083,请指教

我想解压一个nodejs模块socket.io。 我得到一个生成错误来安装Visual的stdio 2005和.net framework2 sdk,所以我做到了。 现在我收到以下错误没有build议如何解决它。 请帮帮我。 我正在使用vista,32位。 您的环境已经设置为使用Node.js 0.8.18(ia32)和NPM C:\Users\shane>CD C:\nodefiles C:\NodeFiles>npm install socket.io npm http GET https://registry.npmjs.org/socket.io npm http 304 https://registry.npmjs.org/socket.io npm http GET https://registry.npmjs.org/base64id/0.1.0 npm http GET https://registry.npmjs.org/redis/0.7.3 npm http GET https://registry.npmjs.org/policyfile/0.0.4 npm http GET https://registry.npmjs.org/socket.io-client/0.9.11 npm http 304 https://registry.npmjs.org/base64id/0.1.0 npm http 304 https://registry.npmjs.org/policyfile/0.0.4 npm http 304 https://registry.npmjs.org/redis/0.7.3 npm http 304 https://registry.npmjs.org/socket.io-client/0.9.11 […]

nodejs socket.io不可捕捉的错误

我在nodejs上运行socket.io,在apache网站上运行socket.io客户端。 如果我没有启动nodejs服务器,并且我加载了客户端页面,则错误事件触发时会显示一条空的错误消息,而且我也会将以下内容转储到我的Chrome控制台 GET http://domain.com:1337/socket.io/1/?t=1359731838906 socket.io.js:1659 Socket.handshake socket.io.js:1659 Socket.connect socket.io.js:1699 Socket socket.io.js:1551 io.connect socket.io.js:94 (anonymous function) general.js:7 (anonymous function) 我能做些什么来阻止这个错误被写入控制台?

如何发送一个事件,并用socket.io作为parameter passing一个函数

我正在使用socket.io,我想从我的服务器发出一个事件,并传递一个函数作为参数的对象。 这是我的代码: socket.emit('customEvent', { name : "Test". myFunc : function() { //some logic here } }); 然后在客户端(我的应用程序在浏览器中),我可以访问“名称”属性,但是当我尝试访问“myFunc”,但我得到“未定义”。 这是我的代码 socket.on('customEvent', function(data){ data.myFunc(); }); 什么是正确的方法(如果有可能的话)?

使用socket.io/node.js上传文件块不能处理非文本文件

只是搞乱node.js,我试图得到一个file upload工作,在客户端的文件块,通过socket.io发送件到服务器,并重新组装。 这是一个相当天真的实施,但只是试图学习。 目前,如果我提交一个文本文件,它移动并重新组装正确,但如果我尝试上传说图像文件,编码是搞砸了,文件已损坏。 我在客户端读取二进制string,并将节点fs编码设置为二进制。 还有什么需要发生? 客户代码 while(start < fileSize) { var reader = new FileReader(); reader.onload = function(e){ var data = { "data" : e.target.result, "sequence" : chunkCount++ }; socket.emit("sendChunk", data, function(data){ console.log("Confirmation recieved"); }); console.log("Log: Sent"); }; reader.onerror = function(e){ alert(e.getMessage()); }; var blob = file.slice(start, end); reader.readAsBinaryString(blob); start = end; end = […]