smartsocket/dist/smartsocket.classes.socketconnection.d.ts

51 lines
1.5 KiB
TypeScript
Raw Normal View History

2016-08-08 16:20:00 +00:00
/// <reference types="socket.io" />
/// <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';
/**
* 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
*/
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;
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;
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;
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
}