socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Is the 'resource' config option still supported?

Open pearjoint opened this issue 15 years ago • 5 comments

Specifying a custom resource (of course both on the client and server side) doesn't seem to work any longer. I have a system where users define its URLs for their content so all "system URLs" (ajax calls etc.) start with an 'underscore folder' ie. /_/some/command

So I wanted to relegate Socket.IO to the '/_/sockio/' resource and this worked pre-0.7. Trying both the purported "new Express-style" config-setting and the old-school options object, here's the server-side initialization:

if (@io = socketio.listen(@httpServer, resource: '_/sockio/', transports: ['websocket'], 'flash policy server': false, 'browser client': false))
    @io.configure '', =>
        @io.set('resource', '_/sockio/')
        @io.set('transports', ['websocket'])
        @io.disable('flash policy server')
        @io.disable('browser client')

Tried both /_/sockio and _/sockio/ -- always the requests don't get processed by Socket.IO but my own _ URL handler, unlike in the previous version (0.6.x). Am I doing it wrong?

pearjoint avatar Jul 05 '11 17:07 pearjoint

Yes its still supported, but we didn't document it because we feel that you shouldn't mess with it. See https://github.com/LearnBoost/socket.io/blob/master/lib/manager.js#L67

3rd-Eden avatar Jul 07 '11 22:07 3rd-Eden

So what's wrong with my code then? o_O

pearjoint avatar Jul 08 '11 18:07 pearjoint

@pearjoint you probably did something wrong on the client side.

Working example: https://gist.github.com/1102456

3rd-Eden avatar Jul 24 '11 09:07 3rd-Eden

Is this still supported? I can't get it to work in my application

noahfreedman avatar Jul 06 '14 10:07 noahfreedman

It's the same issue for me. I would like to change the path but the option 'resource' doesn't change anything! I try to put nginx as reverse proxy of nodejs.

Monpoke avatar Jul 22 '14 21:07 Monpoke