mirror of https://github.com/calzoneman/sync.git
Add localStorage flag for connecting to alt server list
This commit is contained in:
parent
a33f3d8bb0
commit
72bd3e4c98
|
@ -37,7 +37,8 @@ class BackendModule {
|
|||
const redisClientProvider = this.getRedisClientProvider();
|
||||
this.redisAdapter = redisAdapter({
|
||||
pubClient: redisClientProvider.get(),
|
||||
subClient: redisClientProvider.get()
|
||||
// return_buffers is needed for msgpack-js to function correctly
|
||||
subClient: redisClientProvider.get({ return_buffers: true })
|
||||
});
|
||||
this.sioEmitter = require('socket.io').instance;
|
||||
this.sioEmitter.adapter(this.redisAdapter);
|
||||
|
|
|
@ -1119,8 +1119,17 @@ setupCallbacks = function() {
|
|||
return;
|
||||
}
|
||||
|
||||
var servers;
|
||||
if (socketConfig.alt && socketConfig.alt.length > 0 &&
|
||||
localStorage.useAltServer) {
|
||||
servers = socketConfig.alt;
|
||||
console.log("Using alt servers: " + JSON.stringify(servers));
|
||||
} else {
|
||||
servers = socketConfig.servers;
|
||||
}
|
||||
|
||||
var chosenServer = null;
|
||||
socketConfig.servers.forEach(function (server) {
|
||||
servers.forEach(function (server) {
|
||||
if (chosenServer === null) {
|
||||
chosenServer = server;
|
||||
} else if (server.secure && !chosenServer.secure) {
|
||||
|
@ -1130,6 +1139,8 @@ setupCallbacks = function() {
|
|||
}
|
||||
});
|
||||
|
||||
console.log("Connecting to " + JSON.stringify(chosenServer));
|
||||
|
||||
if (chosenServer === null) {
|
||||
makeAlert("Error",
|
||||
"Socket.io configuration was unable to find a suitable server",
|
||||
|
|
Loading…
Reference in New Issue