TypeError: Object #<Server> has no method 'configure'

504 views
Skip to first unread message

Amar Chavan

unread,
Aug 27, 2014, 3:01:17 AM8/27/14
to nod...@googlegroups.com

Hello,
When I try to run "node file.js" in command prompt. I get the following error.
socket.configure(function() {
^
TypeError: Object # has no method 'configure'
at init (C:\Users\user10\Desktop\trial1\game.js:8:9)
at Object. (C:\Users\user10\Desktop\trial1\game.js:13:1)
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:906:3

here is my code :

var util = require("util"),
io = require("socket.io");
var socket,
players;
function init() {
players = [];
socket = io.listen(8000);
socket.configure(function() {
socket.set("transports", ["websocket"]);
socket.set("log level", 2);
});
};
init();

Please help me to solve this.
Thank You

mscdex

unread,
Aug 27, 2014, 9:19:54 AM8/27/14
to nod...@googlegroups.com
On Wednesday, August 27, 2014 3:01:17 AM UTC-4, Amar Chavan wrote:

Hello,
When I try to run "node file.js" in command prompt. I get the following error.
socket.configure(function() {
^
TypeError: Object # has no method 'configure'



Isn't `configure()` an Express thing, not a Socket.IO thing?

greelgorke

unread,
Aug 27, 2014, 3:35:54 PM8/27/14
to nod...@googlegroups.com
i asume, you're using socket.io 1.X. but configure is from 0.9. see here:  http://socket.io/docs/migrating-from-0-9/#configuration-differences

Ryan Schmidt

unread,
Aug 27, 2014, 4:34:20 PM8/27/14
to nod...@googlegroups.com
Well it sounds like the socket object doesn't have a method called configure. Have you checked the socket.io documentation? I didn't find any occurrences of the word "configure" there so that must not be how you're supposed to use it.

http://socket.io/docs/



Reply all
Reply to author
Forward
0 new messages