Testing socket.io server code

276 views
Skip to first unread message

Josh

unread,
May 19, 2011, 7:34:09 PM5/19/11
to Socket.IO
What do folks use to simulate a socket.io *client* for testing server
side (node.js) code?

I was taking a look at the (possibly somewhat old) test code here:
https://github.com/LearnBoost/Socket.IO-node/blob/master/tests/transports.websocket.js#L27-30

But im not too familiar with this api and its requiring something deep
in /support/ which looks to be a module that isn't on npm anymore.

If I were to use this module, anyone know what I should be doing with
the constructor here:
new WebSocket('ws://localhost:' + server._port + '/socket.io/
websocket' + sessid, 'borf');

Is '/socket.io/websocket' + sessid an under the covers default
'channel' in socket.io?

And what is 'borf' ;-)?

Josh

Guillermo Rauch

unread,
May 19, 2011, 7:36:21 PM5/19/11
to sock...@googlegroups.com
Haha borf is the default in @pgriess' example that I copy-pasted. There's a new test-case in the develop branch:

The next step is to add the `acceptance` tests which would be using socket.io-node-client (still needs a few updates).

-- 
Guillermo Rauch
http://devthought.com

Josh

unread,
May 19, 2011, 9:22:31 PM5/19/11
to Socket.IO
Cool. Just took a look a socket.io-node-client -- looks to be exactly
what I was after. I assume this isn't compatible with pre 0.7 api? In
that case, I'll get this minimal hack on top of WebSocket() working

Josh

On May 19, 4:36 pm, Guillermo Rauch <rau...@gmail.com> wrote:
> Haha borf is the default in @pgriess' example that I copy-pasted. There's a new test-case in the develop branch:https://github.com/LearnBoost/Socket.IO-node/tree/develop/test
>
> The next step is to add the `acceptance` tests which would be using socket.io-node-client (still needs a few updates).
> --
> Guillermo Rauchhttp://devthought.comhttp://learnboost.com
>
>
>
>
>
>
>
> On Thursday, May 19, 2011 at 4:34 PM, Josh wrote:
> > What do folks use to simulate a socket.io *client* for testing server
> > side (node.js) code?
>
> > I was taking a look at the (possibly somewhat old) test code here:
> >https://github.com/LearnBoost/Socket.IO-node/blob/master/tests/transp...

Guillermo Rauch

unread,
May 19, 2011, 9:30:28 PM5/19/11
to sock...@googlegroups.com
Yup that's what I do.

-- 
Guillermo Rauch
http://devthought.com

Guillermo Rauch

unread,
May 19, 2011, 9:30:30 PM5/19/11
to sock...@googlegroups.com
Yup that's what I do.

-- 
Guillermo Rauch
http://devthought.com

On Thursday, May 19, 2011 at 6:22 PM, Josh wrote:

Reply all
Reply to author
Forward
0 new messages