Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
d6e81288b4 | |||
c441d89596 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "1.1.44",
|
"version": "1.1.45",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "1.1.44",
|
"version": "1.1.45",
|
||||||
"description": "easy and secure websocket communication",
|
"description": "easy and secure websocket communication",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -58,14 +58,14 @@ export class SmartsocketClient {
|
|||||||
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
|
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
|
||||||
});
|
});
|
||||||
this.socketConnection.socket.on('requestAuth', () => {
|
this.socketConnection.socket.on('requestAuth', () => {
|
||||||
console.log('server requested authentication');
|
plugins.smartlog.defaultLogger.log('info', 'server requested authentication');
|
||||||
this.socketConnection.socket.emit('dataAuth', {
|
this.socketConnection.socket.emit('dataAuth', {
|
||||||
role: this.socketRole.name,
|
role: this.socketRole.name,
|
||||||
password: this.socketRole.passwordHash,
|
password: this.socketRole.passwordHash,
|
||||||
alias: this.alias
|
alias: this.alias
|
||||||
});
|
});
|
||||||
this.socketConnection.socket.on('authenticated', () => {
|
this.socketConnection.socket.on('authenticated', () => {
|
||||||
console.log('client is authenticated');
|
plugins.smartlog.defaultLogger.log('info', 'client is authenticated');
|
||||||
this.socketConnection.authenticated = true;
|
this.socketConnection.authenticated = true;
|
||||||
this.socketConnection.listenToFunctionRequests();
|
this.socketConnection.listenToFunctionRequests();
|
||||||
done.resolve();
|
done.resolve();
|
||||||
|
@ -42,7 +42,6 @@ export class SocketFunction {
|
|||||||
smartsocketRefArg: Smartsocket | SmartsocketClient,
|
smartsocketRefArg: Smartsocket | SmartsocketClient,
|
||||||
functionNameArg: string
|
functionNameArg: string
|
||||||
): SocketFunction {
|
): SocketFunction {
|
||||||
console.log(smartsocketRefArg.socketFunctions);
|
|
||||||
return smartsocketRefArg.socketFunctions.find(socketFunctionArg => {
|
return smartsocketRefArg.socketFunctions.find(socketFunctionArg => {
|
||||||
return socketFunctionArg.name === functionNameArg;
|
return socketFunctionArg.name === functionNameArg;
|
||||||
});
|
});
|
||||||
|
@ -54,11 +54,11 @@ export class SocketServer {
|
|||||||
// in case an external server has been set "this.standaloneServer" should be false
|
// in case an external server has been set "this.standaloneServer" should be false
|
||||||
if (this.httpServer && this.standaloneServer) {
|
if (this.httpServer && this.standaloneServer) {
|
||||||
if (!this.smartsocket.options.port) {
|
if (!this.smartsocket.options.port) {
|
||||||
console.log('there should be a port specifed for smartsocket!');
|
plugins.smartlog.defaultLogger.log('error', 'there should be a port specifed for smartsocket!');
|
||||||
throw new Error('there should be a port specified for smartsocket');
|
throw new Error('there should be a port specified for smartsocket');
|
||||||
}
|
}
|
||||||
this.httpServer.listen(this.smartsocket.options.port, () => {
|
this.httpServer.listen(this.smartsocket.options.port, () => {
|
||||||
console.log(`Server started in standalone mode on ${this.smartsocket.options.port}`);
|
plugins.smartlog.defaultLogger.log('success', `Server started in standalone mode on ${this.smartsocket.options.port}`);
|
||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user