2016-08-08 16:20:00 +00:00
|
|
|
/// <reference types="socket.io" />
|
2016-08-12 03:56:40 +00:00
|
|
|
/// <reference types="socket.io-client" />
|
2018-03-15 01:29:40 +00:00
|
|
|
import * as plugins from './smartsocket.plugins';
|
2017-07-07 20:02:19 +00:00
|
|
|
import { Smartsocket } from './smartsocket.classes.smartsocket';
|
|
|
|
import { SocketRole } from './smartsocket.classes.socketrole';
|
2018-03-15 01:29:40 +00:00
|
|
|
import * as SocketIO from 'socket.io';
|
2016-08-15 00:36:17 +00:00
|
|
|
/**
|
|
|
|
* defines is a SocketConnection is server or client side. Important for mesh setups.
|
|
|
|
*/
|
2017-07-07 20:02:19 +00:00
|
|
|
export declare type TSocketConnectionSide = 'server' | 'client';
|
2016-08-09 09:42:21 +00:00
|
|
|
/**
|
|
|
|
* interface for constructor of class SocketConnection
|
|
|
|
*/
|
2016-08-12 03:56:40 +00:00
|
|
|
export interface ISocketConnectionConstructorOptions {
|
2016-08-14 01:25:26 +00:00
|
|
|
alias: string;
|
2016-08-08 16:20:00 +00:00
|
|
|
authenticated: boolean;
|
2016-08-14 01:25:26 +00:00
|
|
|
role: SocketRole;
|
2016-08-15 00:36:17 +00:00
|
|
|
side: TSocketConnectionSide;
|
2016-09-04 22:34:09 +00:00
|
|
|
smartsocketHost: Smartsocket;
|
2016-08-14 01:25:26 +00:00
|
|
|
socket: SocketIO.Socket | SocketIOClient.Socket;
|
2016-08-08 16:20:00 +00:00
|
|
|
}
|
2016-08-09 09:42:21 +00:00
|
|
|
/**
|
|
|
|
* interface for authentication data
|
|
|
|
*/
|
|
|
|
export interface ISocketConnectionAuthenticationObject {
|
2017-07-07 20:02:19 +00:00
|
|
|
role: 'coreflowContainer';
|
|
|
|
password: 'somePassword';
|
|
|
|
alias: 'coreflow1';
|
2016-08-09 09:42:21 +00:00
|
|
|
}
|
2018-03-15 01:29:40 +00:00
|
|
|
export declare let allSocketConnections: plugins.lik.Objectmap<SocketConnection>;
|
2016-08-09 09:42:21 +00:00
|
|
|
/**
|
|
|
|
* class SocketConnection represents a websocket connection
|
|
|
|
*/
|
2016-08-08 16:20:00 +00:00
|
|
|
export declare class SocketConnection {
|
2016-08-14 01:25:26 +00:00
|
|
|
alias: string;
|
2016-08-15 00:36:17 +00:00
|
|
|
side: TSocketConnectionSide;
|
2016-08-08 16:20:00 +00:00
|
|
|
authenticated: boolean;
|
2016-08-14 01:25:26 +00:00
|
|
|
role: SocketRole;
|
2016-09-04 22:34:09 +00:00
|
|
|
smartsocketHost: Smartsocket;
|
2017-07-07 20:02:19 +00:00
|
|
|
socket: any;
|
2016-08-12 03:56:40 +00:00
|
|
|
constructor(optionsArg: ISocketConnectionConstructorOptions);
|
2016-08-09 09:42:21 +00:00
|
|
|
/**
|
|
|
|
* authenticate the socket
|
|
|
|
*/
|
2017-07-07 20:02:19 +00:00
|
|
|
authenticate(): Promise<{}>;
|
2016-08-09 09:42:21 +00:00
|
|
|
/**
|
|
|
|
* listen to function requests
|
|
|
|
*/
|
2017-07-07 20:02:19 +00:00
|
|
|
listenToFunctionRequests(): Promise<{}>;
|
2016-08-08 16:20:00 +00:00
|
|
|
}
|