Code Monkey home page Code Monkey logo

Comments (3)

hikari-no-yume avatar hikari-no-yume commented on July 21, 2024

You don't necessarily need to do it at the HTTP header level. You could always do it yourself in your protocol.

from websocket-node.

theturtle32 avatar theturtle32 commented on July 21, 2024

Yes. Theoretically you could use HTTP basic auth, but I wouldn't recommend it. The WebSocket specification does not include any kind of authentication mechanism. It is left to the individual protocol designer to decide how best to perform authentication in their application.

The simplest thing to do might be to send the credentials from the client as the first message after the connection is successful, and then send back a response from the server, additionally closing the connection if the authentication failed. Obviously the server shouldn't process any other kind of messages until the authentication phase is complete.

Sent from my iPhone

On Jan 6, 2013, at 2:17 PM, Andrew Faulds [email protected] wrote:

You don't necessarily need to do it at the HTTP header level. You could always do it yourself in your protocol.


Reply to this email directly or view it on GitHub.

from websocket-node.

hikari-no-yume avatar hikari-no-yume commented on July 21, 2024

That's precisely what I do. The easiest way is just to do conn.once('message', function () { ... }), and then set your normal message handler (conn.on('message', function () { ... })) in that handler if the login was correct.

from websocket-node.

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.