Comments (3)
Ah yes, the example script on the socketcluster-client GitHub page only applies for same-domain connections. As you mentioned, you do have to use different settings if you want to do cross-domain requests. That's definitely something we should mention in the documentation - It is a common use case.
from socketcluster-client.
I wasn't able to reproduce this issue.
This is what my server.js looks like:
var SocketCluster = require('socketcluster').SocketCluster;
var socketCluster = new SocketCluster({
balancers: 1,
workers: 1,
stores: 1,
port: 8000,
appName: 'myapp',
workerController: __dirname + '/worker.js',
balancerController: __dirname + '/balancer.js',
storeController: __dirname + '/store.js',
addressSocketLimit: 0,
socketEventLimit: 100,
rebootWorkerOnCrash: true,
protocol: 'https',
protocolOptions: {
pfx: require('fs').readFileSync(__dirname + '/certificate.pfx'),
passphrase: ''
}
});
On the client I have:
var options = {
protocol: location.protocol.replace(/:$/, ''),
hostname: location.hostname,
port: 8000,
autoReconnect: true
};
// Initiate the connection to the server
var socket = socketCluster.connect(options);
When I go to https://localhost:8000/
It shows me a SSL warning page (as expected - since I'm using a self-signed cert), I click OK and then it appears to work fine.
I opened the network tab on the Chrome developer panel and the socket handshake was https:// and the WebSocket connection was wss:// which is correct.
I added a console.log(this.secure); inside socketcluster.js and it output true.
There must be a difference between our code which makes it not work for you.
The logic for setting the this.secure based on protocol is in engine.io so this could be an engine.io-client bug.
from socketcluster-client.
The port should be 443, and I am connecting to another domain too (CORS).
from socketcluster-client.
Related Issues (20)
- socketCluster client on the backend
- Increases temperature on ios devices HOT 2
- TypeError: cb is not a function HOT 8
- Update release Page HOT 1
- Not able to run the client on the office-js in excel desktop HOT 2
- Subscribe method causes error in IE11 HOT 9
- TypeError: _iterator[Symbol.iterator] is not a function || For await of loop not working on Mobile (React Native) HOT 2
- Please bump version of remote socketcluster-client
- Remove gulp, and babel dependencies
- Can this client be used in non browser environment ?
- [docs] Add description about `autoReconnectOptions` option
- Unable to resolve as a es module
- Need help for implemeting a real-time chat HOT 1
- Incorrect disconnect code HOT 1
- socketcluster-client with protocol v1 HOT 1
- How to use "subscribeWildcard" instead of "subscribe" ? HOT 1
- How we add headers in socketclusterclient HOT 5
- I got TypeError: Object is not async iterable error while trying to listen to message event in React Native app
- Docs & readme incorrect on "rejectUnauthorized" HOT 3
- eventObject timeout has a timeout set when it's not expecting a response
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 socketcluster-client.