Giter Site home page Giter Site logo

Comments (6)

wcamarao avatar wcamarao commented on July 25, 2024

Sorry I have no idea what you're talking about, can you give more details?

from session.socket.io.

kanle485 avatar kanle485 commented on July 25, 2024

Sorry functioncallback, i wasn't clear. Let me explain :
My purpose is to use the namespace feature of socket.io with your plugin. In the docs of socket.io, it is used like this as an example :

var chat = io.of('/chat').on('connection', function() {});

But when i try to integrate this to your plugin like below :

var SessionSockets = require('session.socket.io')
, sessionSockets = new SessionSockets(io.of('/chat'), sessionStore, cookieParser);

it states that "Object has no method 'on' " in "session.socket.io.js:5

So in that line, i had to change io.sockets.on( ...... to io.on( ....... ( I removed .sockets)
That way it worked! As i'm new to node.js and socket.io i don't really have any idea how it's architected under the hood but, following the main socket.io docs led me to do it.

If you know any proper way to do this, i'd be glad to hear.
Thanks

from session.socket.io.

wcamarao avatar wcamarao commented on July 25, 2024

Hm I see. Today sessionSockets gives you an api to call only .on('connection', ...) and not .of('/namespace').on(...), however that would be pretty simple to implement, so we could do sessionSockets.of('/ns').on(...) the same way we do when using the io object directly, and it would just delegate internally. I will let you know when I make this change, for now you may keep the way you have done since it's working fine. Thanks for sharing more details from your use case.

from session.socket.io.

kanle485 avatar kanle485 commented on July 25, 2024

Thanks for your help functioncallback. I hope others can also benefit from the use case.

from session.socket.io.

JohnDoeKyrgyz avatar JohnDoeKyrgyz commented on July 25, 2024

The pull request I submitted implements the 'of' method.

from session.socket.io.

wcamarao avatar wcamarao commented on July 25, 2024

Sorry it took awhile @kanle485, this is now done and published on npm as version 0.1.3. Please let me know it that works for you. Thanks!

from session.socket.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.