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

49 lines
1.4 KiB
TypeScript
Raw Normal View History

2016-08-08 16:20:00 +00:00
/// <reference types="socket.io" />
/// <reference types="socket.io-client" />
2016-08-09 09:42:21 +00:00
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { Objectmap } from "lik";
2016-08-09 09:42:21 +00:00
import { SocketRole } from "./smartsocket.classes.socketrole";
/**
* defines is a SocketConnection is server or client side. Important for mesh setups.
*/
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-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 {
role: "coreflowContainer";
password: "somePassword";
alias: "coreflow1";
}
export declare let allSocketConnections: 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;
socket: SocketIO.Socket | SocketIOClient.Socket;
constructor(optionsArg: ISocketConnectionConstructorOptions);
2016-08-09 09:42:21 +00:00
/**
* authenticate the socket
*/
authenticate(): plugins.q.Promise<{}>;
/**
* listen to function requests
*/
listenToFunctionRequests(): plugins.q.Promise<{}>;
2016-08-08 16:20:00 +00:00
}