TypeError: #<XHR> is not a function Moo server , Socket.io 1.0.0-pre

177 views
Skip to first unread message

utan

unread,
Mar 20, 2014, 1:18:47 PM3/20/14
to mootool...@googlegroups.com
Hi guys,

I reported this issue to the project dev, but he didn't dig on the issue till the socket.io 1 gets released, well  the pre 1 is released and the issue persist..

Just to inform, this issue with Moo doesn't exist with  tagged Socket.io 0.9.16, I have the code working perfectly with that version but when I try to refactor my code to new socket.io 1.0.0-pre I get the following error:

moo.io/node_modules/mootools/lib/mootools-core-1.4.5-server.js:218
                return method.apply(item, slice.call(arguments, 1));
                              ^
TypeError: #<XHR> is not a function

here is the server code:

https://gist.github.com/utan/9499923

and

https://gist.github.com/utan/9500023

I have not enough acknowledge to fix this issue, if anyone could help I will greatly appreciate it.

utan

unread,
Mar 20, 2014, 6:52:58 PM3/20/14
to mootool...@googlegroups.com
ok,
thanks for helping.

Sanford Whiteman

unread,
Mar 20, 2014, 7:30:49 PM3/20/14
to utan
If you can come up with some environment in which this can be debugged
remotely, I'll look at it. However, I don't use Socket.io myself and
it's a bit much to start using it to check out this issue.

-- S.

Dimitar Christoff

unread,
Mar 20, 2014, 7:40:19 PM3/20/14
to mootool...@googlegroups.com
I do use socket.io. and have written transport wrappers for socket.io via mootools class and now primish, both for the server and client.

though I am not sure what the error is, sounds like it's trying to reference Request under node, which is not available under mootools-server for obvious reasons. I may have a play tomorrow if you post your moo.io repo/branch to pull and an example. 
--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Dimitar Christoff

"JavaScript is to JAVA what hamster is to ham"
@D_mitar - https://github.com/DimitarChristoff

utan

unread,
Mar 20, 2014, 7:43:53 PM3/20/14
to mootool...@googlegroups.com
@Sanford Whiteman,

I have make you SSH account in my test bed, how can I pass you the credentials?

utan

unread,
Mar 20, 2014, 7:47:28 PM3/20/14
to mootool...@googlegroups.com
@Dimitar Christoff,

Thanks for you kind response,

Please try as well,  It does error with socket.io 1.0.0-pre , there is no Request require in the code...

Also I am not good at Github I can't upload my test to , but I will see if I can learn how to make my own projects now..

utan

unread,
Mar 20, 2014, 8:33:38 PM3/20/14
to mootool...@googlegroups.com
@Dimitar Christoff,

I play a little with github and could make a repository.

https://github.com/utan/moo.io

utan

unread,
Mar 20, 2014, 8:55:59 PM3/20/14
to mootool...@googlegroups.com
I forgot to create the client..
here is it:

https://github.com/utan/moo.io-client

Sanford Whiteman

unread,
Mar 21, 2014, 12:57:28 AM3/21/14
to utan
> I have make you SSH account in my test bed, how can I pass you the credentials?

Mmm... can we see what Dimitar comes up with first?

-- S.







utan

unread,
Mar 21, 2014, 12:59:48 AM3/21/14
to mootool...@googlegroups.com
Sure, no problem.. hope he figure what the problem is..

If not then just let me know how to pass u credentials.

Dimitar Christoff

unread,
Mar 21, 2014, 6:07:59 AM3/21/14
to mootool...@googlegroups.com
hrm - not sure. looks like a mootools extend is causing an issue in
the way it's being used when Array.each is coming on..

it's trying to implement the sparse [ undefined ] being passed in here
forEach function Array() { [native code] } [ undefined ]

/Users/coda/temp/moo.io/node_modules/mootools/lib/mootools-core-1.4.5-server.js:222
return method.apply(item, slice.call(arguments, 1));
^
TypeError: #<XHR> is not a function
at Array.forEach (native)
at Function.implement [as forEach]
(/Users/coda/temp/moo.io/node_modules/mootools/lib/mootools-core-1.4.5-server.js:222:17)
at Array.implement.each
(/Users/coda/temp/moo.io/node_modules/mootools/lib/mootools-core-1.4.5-server.js:339:9)
at XHR.Socket.setupSendCallback
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/socket.js:264:21)
at XHR.EventEmitter.emit (events.js:126:20)
at XHR.Polling.onPollRequest
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/transports/polling.js:97:8)
at XHR.Polling.onRequest
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/transports/polling.js:53:10)
at XHR.onRequest
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/transports/polling-xhr.js:47:33)
at Server.handshake
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/server.js:232:13)
at Server.handleRequest
(/Users/coda/temp/moo.io/node_modules/socket.io/node_modules/engine.io/lib/server.js:176:10)

Process finished with exit code 1

As an experiment, I replaced the mootools code with primish and it
works fine... (`npm i primish` first)
https://gist.github.com/anonymous/9d8140fbf69efc468638

So he XHR object somewhere messes up - I may have time to look at it
later but it does not sound like a mootools issue, probably it's
passing through non-enumerables or something silly.

On 21 March 2014 04:59, utan <vcompu...@gmail.com> wrote:
> Sure, no problem.. hope he figure what the problem is..
>
> If not then just let me know how to pass u credentials.
>

Dimitar Christoff

unread,
Mar 21, 2014, 6:36:10 AM3/21/14
to mootool...@googlegroups.com
found their error. server.js line 263 for var in without hasOwnProperty check. 

change to `if (seqFn.hasOwnProperty(i) && 'function' == typeof seqFn[i]) {` and it works fine 

Dimitar Christoff

unread,
Mar 21, 2014, 6:37:26 AM3/21/14
to mootool...@googlegroups.com
sorry that's socket.js not server. on mobile now. :)

Dimitar Christoff

unread,
Mar 21, 2014, 7:33:03 AM3/21/14
to mootool...@googlegroups.com
fixed and sent a pull request - https://github.com/LearnBoost/engine.io/pull/236

utan

unread,
Mar 21, 2014, 10:52:08 AM3/21/14
to mootool...@googlegroups.com
Great man,

Really appreciate, hope is pulled to socket.io master..

Thanks for both of you.

Dimitar Christoff

unread,
Mar 21, 2014, 11:00:53 AM3/21/14
to mootool...@googlegroups.com
that can only happen once engine.io releases a new npm then a sep pr for socket.io up bump dep ver. 

you can fix locally via Object.defineProperty(Array.prototype, prop, { enumerable: false }) for all custom mootools methods. 
--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimitar Christoff

unread,
Mar 21, 2014, 11:47:01 AM3/21/14
to mootool...@googlegroups.com
Here's a sample func you can call after you require mootools:

http://jsfiddle.net/nXW43/

use as in the fiddle, fixProto(Array.prototype, []); - all enumerables added by MooTools will be gone.

Sanford Whiteman

unread,
Mar 21, 2014, 2:11:22 PM3/21/14
to Dimitar Christoff
Thanks much @D_mitar.

-- S.

utan

unread,
Mar 21, 2014, 3:15:08 PM3/21/14
to mootool...@googlegroups.com
@Dinitar Christoff,

Your function fixed it.. thanks again

Dimitar Christoff

unread,
Mar 25, 2014, 10:54:22 AM3/25/14
to mootool...@googlegroups.com
In other news, Guillermo merged my fix -
https://github.com/LearnBoost/engine.io/pull/236 - still not sure if
he's done the actual socket.io change to use the engine.io thing but
it's happening.

On 21 March 2014 19:15, utan <vcompu...@gmail.com> wrote:
> @Dinitar Christoff,
>
> Your function fixed it.. thanks again
>
Message has been deleted

utan

unread,
Mar 25, 2014, 10:59:35 AM3/25/14
to mootool...@googlegroups.com
@Dimitar,
He hasnt , i have test it.. but i am not affraid to patch it myself since it will be available in the next versio..

Dimitar Christoff

unread,
Mar 27, 2014, 10:20:02 AM3/27/14
to mootool...@googlegroups.com
updated that hidey script to include more MooTools Types that have been extended.

http://jsfiddle.net/dimitar/9RmkW/
Reply all
Reply to author
Forward
0 new messages