API changes, add documentation
This commit is contained in:
parent
7b5476874d
commit
21c3a1b3cd
6 changed files with 124 additions and 32 deletions
|
|
@ -3,21 +3,45 @@ export default class IOConfiguration {
|
|||
this.config = config;
|
||||
}
|
||||
|
||||
getSocketURL() {
|
||||
return this.config.urls[0];
|
||||
getSocketEndpoints() {
|
||||
return this.config.endpoints.slice();
|
||||
}
|
||||
}
|
||||
|
||||
IOConfiguration.fromOldConfig = function (oldConfig) {
|
||||
const config = {
|
||||
urls: []
|
||||
endpoints: []
|
||||
};
|
||||
|
||||
['ipv4-ssl', 'ipv4-nossl', 'ipv6-ssl', 'ipv6-nossl'].forEach(key => {
|
||||
if (oldConfig.get('io.' + key)) {
|
||||
config.urls.push(oldConfig.get('io.' + key));
|
||||
}
|
||||
});
|
||||
if (oldConfig.get('io.ipv4-ssl')) {
|
||||
config.endpoints.push({
|
||||
url: oldConfig.get('io.ipv4-ssl'),
|
||||
secure: true
|
||||
});
|
||||
}
|
||||
|
||||
if (oldConfig.get('io.ipv4-nossl')) {
|
||||
config.endpoints.push({
|
||||
url: oldConfig.get('io.ipv4-nossl'),
|
||||
secure: false
|
||||
});
|
||||
}
|
||||
|
||||
if (oldConfig.get('io.ipv6-ssl')) {
|
||||
config.endpoints.push({
|
||||
url: oldConfig.get('io.ipv4-ssl'),
|
||||
secure: true,
|
||||
ipv6: true
|
||||
});
|
||||
}
|
||||
|
||||
if (oldConfig.get('io.ipv6-nossl')) {
|
||||
config.endpoints.push({
|
||||
url: oldConfig.get('io.ipv4-nossl'),
|
||||
secure: false,
|
||||
ipv6: true
|
||||
});
|
||||
}
|
||||
|
||||
return new IOConfiguration(config);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue