Comments (5)
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.
There are essentially 2 parts:
- Add authentication info in the Spark object.
- 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.
@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.
I divided this issue in two: #84 and #85.
from primus.
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)
- Missing dependencies for parser: "json" HOT 1
- Primus->diagnostics->storage-engine forces --unsafe-perm in global install HOT 4
- update documentation to be more explicit around createSocket
- Problem using proxy with primus client side
- Nativescript support HOT 1
- Does the primus web client work with a non-primus websocket server? HOT 4
- How can I know if a connection has been upgraded or not? HOT 4
- import primus client in client JS
- Getting response headers while polling HOT 3
- public connections and connected HOT 1
- Consider to rewrite without prototype pollution? HOT 11
- Primus with Koa and websockets transport HOT 3
- Can you please consider changing "Primus, the creator god of transformers" HOT 3
- primus doesn't accept custom path with engine.io HOT 10
- async plugins support HOT 8
- support of the new uwebsocket version
- Allow Primus instance to select version of transformer/engine library
- Server Side Events (SSE) source HOT 7
- Maximum Concurrent Connection on Primus Server HOT 2
- Consider alternative to deprecated navigator.userAgent getter. HOT 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 primus.