Giter Club home page Giter Club logo

Comments (7)

Raynos avatar Raynos commented on June 16, 2024

One benefit of the low level api is that I could create a websocket server that accepts all streams. MuxDemux it and then try authenticate just sub streams.

This means we can have both public and authenticated websocket apis in one server.

We may also want to consider simplifying the authHandler like (req, cb) {}.

There is also an alternative type of authentication you can do which would look like (stream, cb) {} where stream is a websocket connection. i.e. authentication could be a handshake over the websocket connection. This would require handling the upgrade for all websockets and then doing auth.

from auth-socket.

max-mapper avatar max-mapper commented on June 16, 2024

worked on this a little, try cloning and doing npm install and npm start in one tab, and npm run watch in another

then open:

http://localhost:8080/socket.html (user should be null)

and

http://localhost:8080/socket.html?hello=hello (user should be 'bob')

from auth-socket.

max-mapper avatar max-mapper commented on June 16, 2024

also I couldn't get wss.on("connection" to fire when using wss.handleUpgrade, maybe its a bug in ws??

from auth-socket.

max-mapper avatar max-mapper commented on June 16, 2024

ahh they emit it here https://github.com/einaros/ws/blob/master/lib/WebSocketServer.js#L72-L75

but if you use handleUpgrade manually it won't emit a connection event :(

from auth-socket.

max-mapper avatar max-mapper commented on June 16, 2024

ok just published v1.0.0, check it out :D

from auth-socket.

Raynos avatar Raynos commented on June 16, 2024

@maxogden I had to emit a connection event myself ( https://gist.github.com/Raynos/7651349#file-auth-socket-js-L29 )

from auth-socket.

Raynos avatar Raynos commented on June 16, 2024

@maxogden nice. the client one looks good. the doorknob / persona one doesn't use auth yet.

from auth-socket.

Related Issues (1)

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.