Git Product home page Git Product logo

Comments (5)

3rd-Eden avatar 3rd-Eden commented on August 20, 2024

The biggest problem here is that ws is the only transformer that supports client certificates for the client. And it's a non standard API, so it's not compatible with regular WebSockets..

So i'm not really sure how to deal with this.

from primus.

legege avatar legege commented on August 20, 2024

There are essentially 2 parts:

  1. Add authentication info in the Spark object.
  2. Find a way to set options (key, cert, rejectUnauthorized, ...) on the WebSocket client

For (1): Right now, the problem is that we don't have access to the HTTP request object from the Spark, only the headers. Would it be possible to keep a reference to the request object? Is it dangerous in terms of leaks? This way, when we see a new Spark, we could check who the connection is. It's a bit the same problem with HTTP Basic auth: it's not possible to know who is behind a Spark connection, right? So it's just authorization, no authentication.

For (2), we have to find a way to configure a transformer, or give options to a transformer. A simple solution is to introduce a transformerOptions object to the options object. What do you think?
https://github.com/primus/primus/blob/master/transformers/websockets/client.js#L43

It might be better to split this issue in 2 others.

from primus.

3rd-Eden avatar 3rd-Eden commented on August 20, 2024

@legege I guess we can keep a reference to the HTTP request object. It just requires us to do additional clean up when we destroy the Spark but it should be possible as there is a way of retrieving this socket from from the supported transformers. Sockjs is known to limit developer freedom, we even had to use horrible hacks in order for us to get access to the request headers, getting access to the full request socket would be just, if not more painful.

I think it's best to split this issue up in 2 different issues just because they are quite development heavy features.

from primus.

legege avatar legege commented on August 20, 2024

I divided this issue in two: #84 and #85.

from primus.

legege avatar legege commented on August 20, 2024

I published a gist here to summarize how to do two-way SSL with Primus.io:
https://gist.github.com/legege/8087063

from primus.

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.