now opening and closing correclty on server and client side
This commit is contained in:
parent
bafa94c6ac
commit
c8c481fda0
7
dist/smartuniverse.classes.universe.js
vendored
7
dist/smartuniverse.classes.universe.js
vendored
@ -43,8 +43,8 @@ class Universe {
|
||||
this.smartsocket = new plugins.smartsocket.Smartsocket({
|
||||
port: 12345 // fix this within smartsocket
|
||||
});
|
||||
this.smartsocket.setServer(this.smartexpressServer); // should work with express as well
|
||||
this.smartsocket.startServer();
|
||||
this.smartsocket.setExternalServer('express', this.smartexpressServer); // should work with express as well
|
||||
this.smartsocket.start();
|
||||
// route handling
|
||||
// adds messages
|
||||
const addMessageHandler = new smartexpress_1.Handler('PUT', request => {
|
||||
@ -66,9 +66,10 @@ class Universe {
|
||||
}
|
||||
stopServer() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.smartsocket.stop();
|
||||
yield this.smartexpressServer.stop();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Universe = Universe;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR1bml2ZXJzZS5jbGFzc2VzLnVuaXZlcnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR1bml2ZXJzZS5jbGFzc2VzLnVuaXZlcnNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxtREFBbUQ7QUFFbkQsK0NBQXNEO0FBRXRELG1GQUFrRTtBQUVsRSwrRkFBc0U7QUFDdEUsK0NBQStDO0FBZS9DO0lBVUUsSUFBWSxlQUFlO1FBQ3pCLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDLENBQUM7WUFDOUIsTUFBTSxDQUFDLElBQUksQ0FBQyxvQkFBb0IsQ0FBQztRQUNuQyxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixNQUFNLFdBQVcsR0FBRyx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NkLENBQUMsQ0FBQyxDQUFDO1lBRUgsZ0JBQWdCO1lBQ2hCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxzQkFBTyxDQUFDLEtBQUssRUFBRSxPQUFPLENBQUMsRUFBRTtnQkFDdEQsTUFBTSxXQUFXLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQztnQkFDakMsSUFBSSxDQUFDLGFBQWEsQ0FBQyx1QkFBdUIsQ0FBQyxXQUFXLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDaEUsQ0FBQyxDQUFDLENBQUM7WUFFSCxNQUFNLFlBQVksR0FBRyxJQUFJLG9CQUFLLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFLFNBQVMsQ0FBQyxDQUFDO1lBQ25FLFlBQVksQ0FBQyxVQUFVLENBQUMsaUJBQWlCLENBQUMsQ0FBQztZQUMzQyxZQUFZLENBQUMsVUFBVSxDQUFDLGtCQUFrQixDQUFDLENBQUM7WUFFNUMsTUFBTSxJQUFJLENBQUMsa0JBQWtCLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDeEMsQ0FBQztLQUFBO0lBRVksVUFBVTs7WUFDckIsTUFBTSxJQUFJLENBQUMsV0FBVyxDQUFDLElBQUksRUFBRSxDQUFDO1lBQzlCLE1BQU0sSUFBSSxDQUFDLGtCQUFrQixDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3ZDLENBQUM7S0FBQTtDQUNGO0FBM0VELDRCQTJFQyJ9
|
@ -11,18 +11,18 @@
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^9.4.7",
|
||||
"@types/node": "^9.6.0",
|
||||
"tapbundle": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lik": "^2.0.5",
|
||||
"rxjs": "^5.5.7",
|
||||
"rxjs": "^5.5.8",
|
||||
"smartcli": "^2.0.12",
|
||||
"smartexpress": "^1.0.21",
|
||||
"smartfile": "^4.2.28",
|
||||
"smartrequest": "^1.0.8",
|
||||
"smartrx": "^1.0.5",
|
||||
"smartsocket": "^1.1.16",
|
||||
"smartsocket": "^1.1.19",
|
||||
"smarttime": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -32,15 +32,18 @@ tap.test('should send a message correctly', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
tap.test('should get a obsevable correctly', async () => {
|
||||
tap.test('should get a observable correctly', async () => {
|
||||
testMessageObservable = testUniverseClient.getMessageObservable();
|
||||
});
|
||||
|
||||
tap.test('should receive a message correctly', async () => {
|
||||
// TODO:
|
||||
});
|
||||
|
||||
tap.test('should end the server correctly', async () => {
|
||||
tap.test('should disconnect the client correctly', async () => {
|
||||
testUniverseClient.close();
|
||||
})
|
||||
|
||||
tap.test('should end the server correctly', async (tools) => {
|
||||
await testUniverse.stopServer();
|
||||
});
|
||||
|
||||
|
@ -64,8 +64,10 @@ export class Universe {
|
||||
port: 12345 // fix this within smartsocket
|
||||
});
|
||||
|
||||
this.smartsocket.setServer(this.smartexpressServer as any); // should work with express as well
|
||||
this.smartsocket.startServer();
|
||||
this.smartsocket.setExternalServer(
|
||||
'express',
|
||||
this.smartexpressServer as any); // should work with express as well
|
||||
this.smartsocket.start();
|
||||
|
||||
// route handling
|
||||
// adds messages
|
||||
@ -90,6 +92,7 @@ export class Universe {
|
||||
}
|
||||
|
||||
public async stopServer() {
|
||||
await this.smartsocket.stop();
|
||||
await this.smartexpressServer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -49,4 +49,8 @@ export class UniverseClient {
|
||||
}
|
||||
return this.observableIntake.observable;
|
||||
}
|
||||
|
||||
public close () {
|
||||
this.socketClient.disconnect();
|
||||
}
|
||||
}
|
||||
|
30
yarn.lock
30
yarn.lock
@ -57,8 +57,8 @@
|
||||
"@types/express" "*"
|
||||
|
||||
"@types/lodash@^4.14.55", "@types/lodash@^4.14.97":
|
||||
version "4.14.105"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.105.tgz#9fcc4627a1f98f8f8fce79ddb2bff4afd97e959b"
|
||||
version "4.14.106"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.106.tgz#6093e9a02aa567ddecfe9afadca89e53e5dce4dd"
|
||||
|
||||
"@types/mime@*":
|
||||
version "2.0.0"
|
||||
@ -68,9 +68,9 @@
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
|
||||
"@types/node@*", "@types/node@^9.4.7":
|
||||
version "9.4.7"
|
||||
resolved "http://registry.npmjs.org/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275"
|
||||
"@types/node@*", "@types/node@^9.6.0":
|
||||
version "9.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.0.tgz#d3480ee666df9784b1001a1872a2f6ccefb6c2d7"
|
||||
|
||||
"@types/q@0.x.x":
|
||||
version "0.0.37"
|
||||
@ -312,8 +312,8 @@ clone-stats@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"
|
||||
|
||||
clone@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb"
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f"
|
||||
|
||||
cloneable-readable@^1.0.0:
|
||||
version "1.1.2"
|
||||
@ -501,8 +501,8 @@ engine.io@~3.1.0:
|
||||
uws "~9.14.0"
|
||||
|
||||
es-abstract@^1.5.1:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
|
||||
version "1.11.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.11.0.tgz#cce87d518f0496893b1a30cd8461835535480681"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.1"
|
||||
@ -1268,9 +1268,9 @@ restore-cursor@^2.0.0:
|
||||
onetime "^2.0.0"
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
rxjs@^5.4.3, rxjs@^5.5.2, rxjs@^5.5.7:
|
||||
version "5.5.7"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.7.tgz#afb3d1642b069b2fbf203903d6501d1acb4cda27"
|
||||
rxjs@^5.4.3, rxjs@^5.5.2, rxjs@^5.5.8:
|
||||
version "5.5.8"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.8.tgz#b2b0809a57614ad6254c03d7446dea0d83ca3791"
|
||||
dependencies:
|
||||
symbol-observable "1.0.1"
|
||||
|
||||
@ -1449,9 +1449,9 @@ smartrx@^1.0.5:
|
||||
smartq "^1.1.6"
|
||||
typings-global "^1.0.23"
|
||||
|
||||
smartsocket@^1.1.16:
|
||||
version "1.1.16"
|
||||
resolved "https://registry.yarnpkg.com/smartsocket/-/smartsocket-1.1.16.tgz#930ffdee48ae667a810262ab4e98c30bf2d3b687"
|
||||
smartsocket@^1.1.19:
|
||||
version "1.1.19"
|
||||
resolved "https://registry.yarnpkg.com/smartsocket/-/smartsocket-1.1.19.tgz#60d15ad1af4b2be03ca7a56ce075e52fa0e33e1f"
|
||||
dependencies:
|
||||
"@types/shortid" "0.0.29"
|
||||
"@types/socket.io" "^1.4.32"
|
||||
|
Loading…
Reference in New Issue
Block a user