Comments (7)
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.
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.
also I couldn't get wss.on("connection"
to fire when using wss.handleUpgrade
, maybe its a bug in ws
??
from auth-socket.
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.
ok just published v1.0.0, check it out :D
from auth-socket.
@maxogden I had to emit a connection event myself ( https://gist.github.com/Raynos/7651349#file-auth-socket-js-L29 )
from auth-socket.
@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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth-socket.