websocketiot
Advanced tools
Comparing version
@@ -24,3 +24,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
type ConnectionType = 'client' | 'device' | 'uknown'; | ||
export declare class Connection { | ||
declare class Connection { | ||
static readonly connections: { | ||
@@ -50,12 +50,4 @@ [key: string]: Connection; | ||
} | ||
export declare class Client extends Connection { | ||
declare class Device extends Connection { | ||
readonly connectionType: ConnectionType; | ||
static readonly clients: { | ||
[key: string]: Client; | ||
}; | ||
static readonly addClient: (client: Client) => Client; | ||
constructor(ws: WebSocket, id?: string, run?: MsgHandler); | ||
} | ||
export declare class Device extends Connection { | ||
readonly connectionType: ConnectionType; | ||
get device(): string; | ||
@@ -86,3 +78,3 @@ static readonly DeviceKinds: { | ||
} | ||
export declare class IOTServer { | ||
declare class IOTServer { | ||
readonly port: number; | ||
@@ -101,3 +93,4 @@ readonly app: express.Application; | ||
} | ||
export declare function extraAuth(run: () => void): void; | ||
export {}; | ||
declare function extraAuth(run: () => void): void; | ||
export { IOTServer, Connection, Device, extraAuth }; | ||
export default IOTServer; |
@@ -15,3 +15,3 @@ import { objify, getUniqueID, stringify, extension, fileName, isType, } from './common.js'; | ||
//* connection object | ||
export class Connection { | ||
class Connection { | ||
// statics prop | ||
@@ -87,3 +87,3 @@ static connections = {}; // store the connection | ||
// subClass client, for client | ||
export class Client extends Connection { | ||
class Client extends Connection { | ||
// overrides | ||
@@ -107,3 +107,3 @@ connectionType = 'client'; | ||
// subClass device, for robots | ||
export class Device extends Connection { | ||
class Device extends Connection { | ||
// overrides | ||
@@ -126,3 +126,3 @@ connectionType = 'device'; | ||
} | ||
export class IOTServer { | ||
class IOTServer { | ||
port = 8080; | ||
@@ -171,3 +171,3 @@ app = express(); | ||
var runExtraAuth = () => { }; | ||
export function extraAuth(run) { runExtraAuth = run; } | ||
function extraAuth(run) { runExtraAuth = run; } | ||
// authenticate who is connecting | ||
@@ -213,3 +213,5 @@ function authProtocol(ws) { | ||
} | ||
export { IOTServer, Connection, Device, extraAuth }; | ||
export default IOTServer; | ||
// (new IOTServer({ useRouter: true })) | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "websocketiot", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "npm module for creating node.js-esp websocket IOT project", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -44,3 +44,3 @@ import { | ||
//* connection object | ||
export class Connection { | ||
class Connection { | ||
// statics prop | ||
@@ -108,3 +108,3 @@ public static readonly connections: { [key: string]: Connection } = {};// store the connection | ||
// subClass client, for client | ||
export class Client extends Connection { | ||
class Client extends Connection { | ||
// overrides | ||
@@ -128,3 +128,3 @@ public readonly connectionType: ConnectionType = 'client'; | ||
// subClass device, for robots | ||
export class Device extends Connection { | ||
class Device extends Connection { | ||
// overrides | ||
@@ -172,3 +172,3 @@ public readonly connectionType: ConnectionType = 'device'; | ||
export class IOTServer { | ||
class IOTServer { | ||
readonly port: number = 8080; | ||
@@ -226,3 +226,3 @@ readonly app: express.Application = express(); | ||
var runExtraAuth = () => { }; | ||
export function extraAuth(run: () => void) { runExtraAuth = run } | ||
function extraAuth(run: () => void) { runExtraAuth = run } | ||
@@ -270,2 +270,4 @@ // authenticate who is connecting | ||
} | ||
export { IOTServer, Connection, Device, extraAuth }; | ||
export default IOTServer; | ||
// (new IOTServer({ useRouter: true })) |
Sorry, the diff of this file is not supported yet
40226
-0.26%664
-0.45%