Comments (6)
Problem solved.
protocolOptions: {
key: fs.readFileSync(__dirname + '/privkey.pem'),
cert: fs.readFileSync(__dirname + '/fullchain.pem')
}
Change cert.pem to fullchain.pem. (letsencrypt cert)
from socketcluster-client.
You should use secure: true
instead of protocol: 'https'
in socketcluster-client
.
from socketcluster-client.
This is host options
var options = {
host: 'localhost',
workers: Number(argv.w) || Number(process.env.SOCKETCLUSTER_WORKERS) || 3,
brokers: Number(argv.b) || Number(process.env.SOCKETCLUSTER_BROKERS) || 1,
port: Number(argv.p) || Number(process.env.SOCKETCLUSTER_PORT) || 8500,
// If your system doesn't support 'uws', you can switch to 'ws' (which is slower but works on older systems).
wsEngine: process.env.SOCKETCLUSTER_WS_ENGINE || 'uws',
appName: argv.n || process.env.SOCKETCLUSTER_APP_NAME || null,
workerController: workerControllerPath || __dirname + '/worker.js',
brokerController: brokerControllerPath || __dirname + '/broker.js',
initController: initControllerPath || null,
socketChannelLimit: Number(process.env.SOCKETCLUSTER_SOCKET_CHANNEL_LIMIT) || 1000,
clusterStateServerHost: argv.cssh || process.env.SCC_STATE_SERVER_HOST || null,
clusterStateServerPort: process.env.SCC_STATE_SERVER_PORT || null,
clusterAuthKey: process.env.SCC_AUTH_KEY || null,
clusterStateServerConnectTimeout: Number(process.env.SCC_STATE_SERVER_CONNECT_TIMEOUT) || null,
clusterStateServerAckTimeout: Number(process.env.SCC_STATE_SERVER_ACK_TIMEOUT) || null,
clusterStateServerReconnectRandomness: Number(process.env.SCC_STATE_SERVER_RECONNECT_RANDOMNESS) || null,
crashWorkerOnError: argv['auto-reboot'] != false,
pingTimeout: 1800000,
protocol: 'https',
protocolOptions: {
key: fs.readFileSync(__dirname + '/privkey.pem', 'utf8'),
cert: fs.readFileSync(__dirname + '/cert.pem', 'utf8'),
passphrase: ''
},
socketUpgradeTimeout: 5000,
logLevel: 2
};
from socketcluster-client.
That's such a common mistake, I should probably make the client throw an error or something...
from socketcluster-client.
I trying option secure: true
and it stills hung up.
from socketcluster-client.
I create a simple page for test wss/ws connection at http://mylive.in.th/testwebsocket
It works fine on browser both wss/ws but can connect only ws://
websocket server with nodejs.
<body>
<div><strong>Secured Websocket Connection (port:8500)</strong></div>
<div id="socket1"></div>
<div><strong>Unsecured Websocket Connection (port:80)</strong></div>
<div id="socket2"></div>
</body>
<script src="//jquery/jquery-3.1.1.min.js"></script>
<script src="//socketcluster/socketcluster.min.js"></script>
<script>
// Secured websocket connection
var socket = socketCluster.connect({
hostname: 'chat.socket3.mylive.in.th',
secure: true,
port: 8500
});
// Unsecured websocket connection
var socket2 = socketCluster.connect({
hostname: 'chat.socket3.mylive.in.th',
secure: false,
port: 80
});
socket.on('error', function(e){
$("#socket1").html(e.name);
console.log(e);
});
socket.on('connect', function(status){
$("#socket1").html("connected");
});
socket2.on('error', function(e){
$("#socket2").html(e.name);
console.log(e);
});
socket2.on('connect', function(status){
$("#socket2").html("connected");
});
</script>
from socketcluster-client.
Related Issues (20)
- 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
- SyntaxError: Identifier 'global' has already been declared 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 socketcluster-client.