alexstrat / simudp

NodeJS Socket.io/UDP proxy
10 stars 3 forks source link

binary data #3

Open lazydino opened 9 years ago

lazydino commented 9 years ago

Hi, is simudp capable of handling binary data? Can I transmit and receive byte array?

alexstrat commented 9 years ago

The short answer is "I'm not sure and depends on how you implement it".

The longest answers are:

lazydino commented 9 years ago

Hi, I am re-visiting this repository and try the three lines proxy server provided in ReadMe, but node came back with the following message.

if(server instanceof sio.Manager) ^ TypeError: Expecting a function in instanceof check, but got # at Object.exports.listen (c:\udptest\node_modules\simudp\lib\server.js:49:27 ) at Object. (c:\udptest\app.js:5:19) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3

Can you help? I did not have the right version of socket.io? All I did is just install package via npm and run var server = require('http').createServer();

require('simudp').listen(server);

server.listen(8080);

alexstrat commented 9 years ago

Arrff.. i'm sorry about that. It's an old module I wrote years ago and that I don't maintain anymore. It is probably very dusty..

I was able to get rid of this issue by commenting the culprit lines in ./lib/server.js, but haven't investigate further:

exports.listen = function(server, options) {
  options = options || {};
  var io;

  // if(server instanceof sio.Manager)
  //   io = server;
  // else
    io = sio.listen(server, options['socket.io'] || {});

  new Proxy(io.of('/simudp'), options.port_range, options.whoami);
  //..

(I'm running node v0.12.1, I checkouted the repo and ran npm install .)

It might work like that, but not sure.

Sorry again.

lazydino commented 9 years ago

I just change the socket.io package verion requirement from ">0.9.11" to "^0.9.12", SimUDP will then work with the older socket.io