I want to run example project using simudp.
So I wrote my code like following.
Runs the proxy server :
var server = require('http').createServer();
require('simudp').listen(server);
server.listen(8080);
In the browser:
<!-- you need to serve SimUDP.js by your own -->
<script src="/SimUDP.js"></script>
<script>
var socket = SimUDP.createSocket('udp4');
var hello = new SimUDP.Buffer('hello');
socket.send(hello, 0, hello.length, 3000, 'anywhere.com');
socket.on('message', function(buf, rinfo) {
//...
});
//you've understood, it's dgram for the browser...
</script>
But I am getting following errors
/Users/admin/Documents/Work/Vincent-UDPChannel/imp/node_modules/simudp/lib/server.js:49
if(server instanceof sio.Manager)
^
TypeError: Right-hand side of 'instanceof' is not an object
at Object.exports.listen (/Users/admin/Documents/Work/Vincent-UDPChannel/imp/node_modules/simudp/lib/server.js:49:13)
at Object. (/Users/admin/Documents/Work/Vincent-UDPChannel/imp/server.js:12:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
I want to run example project using simudp. So I wrote my code like following.
Runs the proxy server :
In the browser:
But I am getting following errors /Users/admin/Documents/Work/Vincent-UDPChannel/imp/node_modules/simudp/lib/server.js:49 if(server instanceof sio.Manager) ^
TypeError: Right-hand side of 'instanceof' is not an object at Object.exports.listen (/Users/admin/Documents/Work/Vincent-UDPChannel/imp/node_modules/simudp/lib/server.js:49:13) at Object. (/Users/admin/Documents/Work/Vincent-UDPChannel/imp/server.js:12:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
Can you help me?