reconnect is now working
This commit is contained in:
parent
7b2b2bd151
commit
bd8697ac6e
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,2 +1,4 @@
|
|||||||
export * from "./smartsocket.classes.smartsocket";
|
export * from "./smartsocket.classes.smartsocket";
|
||||||
export * from "./smartsocket.classes.smartsocketclient";
|
export * from "./smartsocket.classes.smartsocketclient";
|
||||||
|
export * from "./smartsocket.classes.socketfunction";
|
||||||
|
export * from "./smartsocket.classes.socketrole";
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -4,5 +4,7 @@ function __export(m) {
|
|||||||
}
|
}
|
||||||
__export(require("./smartsocket.classes.smartsocket"));
|
__export(require("./smartsocket.classes.smartsocket"));
|
||||||
__export(require("./smartsocket.classes.smartsocketclient"));
|
__export(require("./smartsocket.classes.smartsocketclient"));
|
||||||
|
__export(require("./smartsocket.classes.socketfunction"));
|
||||||
|
__export(require("./smartsocket.classes.socketrole"));
|
||||||
// need something more exposed? Create an issue on GitLab!
|
// need something more exposed? Create an issue on GitLab!
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsaUJBQWMsbUNBQW1DLENBQUMsRUFBQTtBQUNsRCxpQkFBYyx5Q0FBeUMsQ0FBQyxFQUFBO0FBRXhELDBEQUEwRCJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsaUJBQWMsbUNBQW1DLENBQUMsRUFBQTtBQUNsRCxpQkFBYyx5Q0FBeUMsQ0FBQyxFQUFBO0FBQ3hELGlCQUFjLHNDQUFzQyxDQUFDLEVBQUE7QUFDckQsaUJBQWMsa0NBQWtDLENBQUMsRUFBQTtBQUVqRCwwREFBMEQifQ==
|
2
dist/smartsocket.classes.smartsocket.js
vendored
2
dist/smartsocket.classes.smartsocket.js
vendored
@ -49,4 +49,4 @@ class Smartsocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Smartsocket = Smartsocket;
|
exports.Smartsocket = Smartsocket;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zbWFydHNvY2tldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc21hcnRzb2NrZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHVCQUF1QixDQUFDLENBQUE7QUFHakQsVUFBVTtBQUNWLHNCQUEwQixLQUFLLENBQUMsQ0FBQTtBQUdoQyx1REFBaUMsd0NBQXdDLENBQUMsQ0FBQTtBQUt6RSxDQUFDO0FBRUY7SUFJSSxZQUFZLFVBQTBDO1FBRHRELGdCQUFXLEdBQUcsSUFBSSxlQUFTLEVBQW9CLENBQUM7UUFxQmhEOztXQUVHO1FBRUgsZ0JBQVcsR0FBRztZQUNWLElBQUksQ0FBQyxFQUFFLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO1lBQzlDLElBQUksQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLFNBQVM7Z0JBQy9CLElBQUksQ0FBQyx1QkFBdUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUM1QyxDQUFDLENBQUMsQ0FBQztRQUNQLENBQUMsQ0FBQTtRQUNELGdCQUFXLEdBQUc7W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QUFJLENBQUMsV0FBVyxDQUFDLElBQUksRUFBRSxDQUFDO1lBQ3hCLElBQUksQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDcEIsQ0FBQyxDQUFDO1FBcENFLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDO0lBQzlCLENBQUM7O0lBRUQ7O09BRUc7SUFDSyx1QkFBdUIsQ0FBQyxTQUFTO1FBQ3JDLElBQUksZ0JBQWdCLEdBQXNCLElBQUksdURBQWdCLENBQUM7WUFDM0QsS0FBSyxFQUFDLFNBQVM7WUFDZixhQUFhLEVBQUMsS0FBSztZQUNuQixJQUFJLEVBQUMsU0FBUztZQUNkLE1BQU0sRUFBQyxTQUFTO1NBQ25CLENBQUMsQ0FBQztRQUNILE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLDZDQUE2QyxDQUFDLENBQUE7UUFDcEUsSUFBSSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztRQUN2QyxnQkFBZ0IsQ0FBQyxZQUFZLEVBQUU7YUFDMUIsSUFBSSxDQUFDLGdCQUFnQixDQUFDLHdCQUF3QixDQUFDLENBQUM7SUFDekQsQ0FBQzs7SUFxQkQsZ0JBQWdCO0lBQ2hCLFVBQVU7UUFFTiw2REFBNkQ7SUFDakUsQ0FBQztBQUNMLENBQUM7QUFoRFksbUJBQVcsY0FnRHZCLENBQUEifQ==
|
@ -23,7 +23,7 @@ class SmartsocketClient {
|
|||||||
alias: this.alias,
|
alias: this.alias,
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
role: undefined,
|
role: undefined,
|
||||||
socket: plugins.socketIoClient(socketUrl, {})
|
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
|
||||||
});
|
});
|
||||||
this.socketConnection.socket.on("requestAuth", () => {
|
this.socketConnection.socket.on("requestAuth", () => {
|
||||||
console.log("server requested authentication");
|
console.log("server requested authentication");
|
||||||
@ -43,6 +43,7 @@ class SmartsocketClient {
|
|||||||
disconnect() {
|
disconnect() {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
this.socketConnection.socket.disconnect();
|
this.socketConnection.socket.disconnect();
|
||||||
|
this.socketConnection = undefined;
|
||||||
plugins.beautylog.ok("disconnected!");
|
plugins.beautylog.ok("disconnected!");
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
@ -67,4 +68,4 @@ class SmartsocketClient {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
exports.SmartsocketClient = SmartsocketClient;
|
exports.SmartsocketClient = SmartsocketClient;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zbWFydHNvY2tldGNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc21hcnRzb2NrZXRjbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHVCQUl6QixDQUFDLENBSitDO0FBT2hELGlCQUFpQjtBQUNqQix1REFBaUMsd0NBQXdDLENBQUMsQ0FBQTtBQUUxRSxvREFBOEIscUNBQXFDLENBQUMsQ0FBQTtBQVlwRTtJQU9JLFlBQVksVUFBb0M7UUFDNUMsSUFBSSxDQUFDLEtBQUssR0FBRyxVQUFVLENBQUMsS0FBSyxDQUFDO1FBQzlCLElBQUksQ0FBQyxJQUFJLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztRQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxHQUFHLENBQUE7UUFDL0IsSUFBSSxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFDO1FBQ2xDLElBQUksQ0FBQyxjQUFjLEdBQUcsVUF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50
|
||||||
|
}
|
||||||
|
}
|
40
test/test.js
40
test/test.js
@ -2,28 +2,46 @@
|
|||||||
require("typings-test");
|
require("typings-test");
|
||||||
require("should");
|
require("should");
|
||||||
const smartsocket = require("../dist/index");
|
const smartsocket = require("../dist/index");
|
||||||
|
const q = require("q");
|
||||||
let testSmartsocket;
|
let testSmartsocket;
|
||||||
let testSmartsocketClient;
|
let testSmartsocketClient;
|
||||||
|
let testSocketFunction1;
|
||||||
let testConfig = {
|
let testConfig = {
|
||||||
port: 3000
|
port: 3000
|
||||||
};
|
};
|
||||||
describe("smartsocket", function () {
|
describe("smartsocket", function () {
|
||||||
|
describe("class Smartsocket", function () {
|
||||||
it("should create a new smartsocket", function () {
|
it("should create a new smartsocket", function () {
|
||||||
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
|
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
|
||||||
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
|
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
|
||||||
});
|
});
|
||||||
it("should register a new Function", function () {
|
|
||||||
});
|
|
||||||
it("should start listening when .started is called", function () {
|
it("should start listening when .started is called", function () {
|
||||||
testSmartsocket.startServer();
|
testSmartsocket.startServer();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
describe("class SocketRole", function () {
|
||||||
|
});
|
||||||
|
describe("class SocketFunction", function () {
|
||||||
|
it("should register a new Function", function () {
|
||||||
|
testSocketFunction1 = new smartsocket.SocketFunction({
|
||||||
|
funcName: "testFunction1",
|
||||||
|
funcDef: () => {
|
||||||
|
let done = q.defer();
|
||||||
|
return done.promise;
|
||||||
|
},
|
||||||
|
allowedRoles: []
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("class SmartsocketClient", function () {
|
||||||
it("should react to a new websocket connection from client", function (done) {
|
it("should react to a new websocket connection from client", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
testSmartsocketClient = new smartsocket.SmartsocketClient({
|
testSmartsocketClient = new smartsocket.SmartsocketClient({
|
||||||
port: testConfig.port,
|
port: testConfig.port,
|
||||||
url: "http://localhost",
|
url: "http://localhost",
|
||||||
password: "testPassword",
|
password: "testPassword",
|
||||||
alias: "testClient1"
|
alias: "testClient1",
|
||||||
|
role: undefined
|
||||||
});
|
});
|
||||||
testSmartsocketClient.connect()
|
testSmartsocketClient.connect()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -33,13 +51,25 @@ describe("smartsocket", function () {
|
|||||||
it("client should disconnect and reconnect", function (done) {
|
it("client should disconnect and reconnect", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
testSmartsocketClient.disconnect()
|
testSmartsocketClient.disconnect()
|
||||||
.then(testSmartsocketClient.connect)
|
.then(() => {
|
||||||
|
let done = q.defer();
|
||||||
|
setTimeout(() => {
|
||||||
|
testSmartsocketClient.connect()
|
||||||
|
.then(done.resolve);
|
||||||
|
}, 0);
|
||||||
|
return done.promise;
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("2 clients should connect in parallel", function () {
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("terminating smartsocket", function () {
|
||||||
it("should close the server", function () {
|
it("should close the server", function () {
|
||||||
testSmartsocket.closeServer();
|
testSmartsocket.closeServer();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUVoQixNQUFPLFdBQVcsV0FBVyxlQUFlLENBQUMsQ0FBQ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FDLFdBQVcsRUFBRSxDQUFDO1FBQ2xDLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQyJ9
|
45
test/test.ts
45
test/test.ts
@ -2,32 +2,50 @@ import "typings-test";
|
|||||||
import "should";
|
import "should";
|
||||||
import socketIoClient = require("socket.io-client");
|
import socketIoClient = require("socket.io-client");
|
||||||
import smartsocket = require("../dist/index");
|
import smartsocket = require("../dist/index");
|
||||||
|
import q = require("q");
|
||||||
|
|
||||||
let testSmartsocket: smartsocket.Smartsocket;
|
let testSmartsocket: smartsocket.Smartsocket;
|
||||||
let testSmartsocketClient: smartsocket.SmartsocketClient;
|
let testSmartsocketClient: smartsocket.SmartsocketClient;
|
||||||
|
let testSocketFunction1:smartsocket.SocketFunction;
|
||||||
|
|
||||||
let testConfig = {
|
let testConfig = {
|
||||||
port:3000
|
port: 3000
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("smartsocket", function () {
|
describe("smartsocket", function () {
|
||||||
|
describe("class Smartsocket", function () {
|
||||||
it("should create a new smartsocket", function () {
|
it("should create a new smartsocket", function () {
|
||||||
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
|
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
|
||||||
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
|
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
|
||||||
});
|
});
|
||||||
it("should register a new Function", function () {
|
|
||||||
|
|
||||||
})
|
|
||||||
it("should start listening when .started is called", function () {
|
it("should start listening when .started is called", function () {
|
||||||
testSmartsocket.startServer();
|
testSmartsocket.startServer();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("class SocketRole", function(){
|
||||||
|
|
||||||
})
|
})
|
||||||
|
describe("class SocketFunction", function () {
|
||||||
|
it("should register a new Function", function () {
|
||||||
|
testSocketFunction1 = new smartsocket.SocketFunction({
|
||||||
|
funcName:"testFunction1",
|
||||||
|
funcDef: () => {
|
||||||
|
let done = q.defer();
|
||||||
|
return done.promise;
|
||||||
|
},
|
||||||
|
allowedRoles:[]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("class SmartsocketClient", function () {
|
||||||
it("should react to a new websocket connection from client", function (done) {
|
it("should react to a new websocket connection from client", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
testSmartsocketClient = new smartsocket.SmartsocketClient({
|
testSmartsocketClient = new smartsocket.SmartsocketClient({
|
||||||
port: testConfig.port,
|
port: testConfig.port,
|
||||||
url: "http://localhost",
|
url: "http://localhost",
|
||||||
password:"testPassword",
|
password: "testPassword",
|
||||||
alias: "testClient1"
|
alias: "testClient1",
|
||||||
|
role: undefined
|
||||||
});
|
});
|
||||||
testSmartsocketClient.connect()
|
testSmartsocketClient.connect()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -37,12 +55,25 @@ describe("smartsocket", function () {
|
|||||||
it("client should disconnect and reconnect", function (done) {
|
it("client should disconnect and reconnect", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
testSmartsocketClient.disconnect()
|
testSmartsocketClient.disconnect()
|
||||||
.then(testSmartsocketClient.connect)
|
.then(() => {
|
||||||
|
let done = q.defer();
|
||||||
|
setTimeout(() => {
|
||||||
|
testSmartsocketClient.connect()
|
||||||
|
.then(done.resolve)
|
||||||
|
}, 0)
|
||||||
|
return done.promise;
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("2 clients should connect in parallel", function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("terminating smartsocket", function () {
|
||||||
it("should close the server", function () {
|
it("should close the server", function () {
|
||||||
testSmartsocket.closeServer();
|
testSmartsocket.closeServer();
|
||||||
});
|
});
|
||||||
|
})
|
||||||
});
|
});
|
@ -2,5 +2,7 @@ import * as plugins from "./smartsocket.plugins";
|
|||||||
|
|
||||||
export * from "./smartsocket.classes.smartsocket";
|
export * from "./smartsocket.classes.smartsocket";
|
||||||
export * from "./smartsocket.classes.smartsocketclient";
|
export * from "./smartsocket.classes.smartsocketclient";
|
||||||
|
export * from "./smartsocket.classes.socketfunction";
|
||||||
|
export * from "./smartsocket.classes.socketrole";
|
||||||
|
|
||||||
// need something more exposed? Create an issue on GitLab!
|
// need something more exposed? Create an issue on GitLab!
|
@ -57,6 +57,7 @@ export class Smartsocket {
|
|||||||
|
|
||||||
// communication
|
// communication
|
||||||
clientCall(){
|
clientCall(){
|
||||||
|
|
||||||
// TODO: target specific client and initiate response
|
// TODO: target specific client and initiate response
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,7 +46,7 @@ export class SmartsocketClient {
|
|||||||
alias:this.alias,
|
alias:this.alias,
|
||||||
authenticated:false,
|
authenticated:false,
|
||||||
role:undefined,
|
role:undefined,
|
||||||
socket: plugins.socketIoClient(socketUrl,{})
|
socket: plugins.socketIoClient(socketUrl,{multiplex:false})
|
||||||
});
|
});
|
||||||
this.socketConnection.socket.on("requestAuth", () => {
|
this.socketConnection.socket.on("requestAuth", () => {
|
||||||
console.log("server requested authentication");
|
console.log("server requested authentication");
|
||||||
@ -65,6 +65,7 @@ export class SmartsocketClient {
|
|||||||
disconnect(){
|
disconnect(){
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
this.socketConnection.socket.disconnect();
|
this.socketConnection.socket.disconnect();
|
||||||
|
this.socketConnection = undefined;
|
||||||
plugins.beautylog.ok("disconnected!");
|
plugins.beautylog.ok("disconnected!");
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
Loading…
Reference in New Issue
Block a user