peer
- Version 1.0.2
- Published
- 203 kB
- 7 dependencies
- MIT license
Install
npm i peer
yarn add peer
pnpm add peer
Overview
PeerJS server component
Index
Functions
Interfaces
Enums
Functions
function ExpressPeerServer
ExpressPeerServer: ( server: https.Server | http.Server, options?: Partial<IConfig>) => express.Express & PeerServerEvents;
function PeerServer
PeerServer: ( options?: Partial<IConfig>, callback?: (server: https.Server | http.Server) => void) => express.Express & PeerServerEvents;
Interfaces
interface IClient
interface IClient {}
method getId
getId: () => string;
method getLastPing
getLastPing: () => number;
method getSocket
getSocket: () => WebSocket | null;
method getToken
getToken: () => string;
method send
send: <T>(data: T) => void;
method setLastPing
setLastPing: (lastPing: number) => void;
method setSocket
setSocket: (socket: WebSocket | null) => void;
interface IConfig
interface IConfig {}
property alive_timeout
readonly alive_timeout: number;
property allow_discovery
readonly allow_discovery: boolean;
property cleanup_out_msgs
readonly cleanup_out_msgs: number;
property concurrent_limit
readonly concurrent_limit: number;
property corsOptions
readonly corsOptions: CorsOptions;
property createWebSocketServer
readonly createWebSocketServer?: (options: ServerOptions) => WebSocketServer;
property expire_timeout
readonly expire_timeout: number;
property generateClientId
readonly generateClientId?: () => string;
property host
readonly host: string;
property key
readonly key: string;
property path
readonly path: string;
property port
readonly port: number;
property proxied
readonly proxied: boolean | string;
property ssl
readonly ssl?: { key: string; cert: string;};
interface IMessage
interface IMessage {}
interface PeerServerEvents
interface PeerServerEvents {}
method on
on: { (event: 'connection', listener: (client: IClient) => void): this; ( event: 'message', listener: (client: IClient, message: IMessage) => void ): this; (event: 'disconnect', listener: (client: IClient) => void): this; (event: 'error', listener: (client: Error) => void): this;};
Enums
enum MessageType
enum MessageType { OPEN = 'OPEN', LEAVE = 'LEAVE', CANDIDATE = 'CANDIDATE', OFFER = 'OFFER', ANSWER = 'ANSWER', EXPIRE = 'EXPIRE', HEARTBEAT = 'HEARTBEAT', ID_TAKEN = 'ID-TAKEN', ERROR = 'ERROR',}
Package Files (1)
Dependencies (7)
Dev Dependencies (24)
- @codedependant/semantic-release-docker
- @parcel/core
- @parcel/packager-ts
- @parcel/transformer-typescript-types
- @semantic-release/changelog
- @semantic-release/git
- @swc/core
- @swc/helpers
- @swc/jest
- @tsconfig/node16
- @tsconfig/strictest
- @types/cors
- @types/jest
- @types/node
- @types/yargs
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint
- jest
- mock-socket
- parcel
- prettier
- semantic-release
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/peer
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/peer)
- HTML<a href="https://www.jsdocs.io/package/peer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3606 ms. - Missing or incorrect documentation? Open an issue for this package.