New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

peerjs

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peerjs - npm Package Compare versions

Comparing version 1.4.6-rc.1 to 1.4.6

47

dist/types.d.ts

@@ -1,2 +0,2 @@

import { EventEmitter } from "eventemitter3";
import { EventEmitter, ValidEventTypes } from "eventemitter3";
export interface UtilSupportsObj {

@@ -55,10 +55,2 @@ browser: boolean;

}
export enum ConnectionEventType {
Open = "open",
Stream = "stream",
Data = "data",
Close = "close",
Error = "error",
IceStateChanged = "iceStateChanged"
}
export enum ConnectionType {

@@ -68,3 +60,2 @@ Data = "data",

}
export type PeerEventType = "open" | "close" | "connection" | "call" | "disconnected" | "error";
export enum PeerErrorType {

@@ -123,3 +114,11 @@ BrowserIncompatible = "browser-incompatible",

}
declare abstract class BaseConnection extends EventEmitter {
type BaseConnectionEvents = {
/**
* Emitted when either you or the remote peer closes the connection.
*/
close: () => void;
error: (error: Error) => void;
iceStateChanged: (state: RTCIceConnectionState) => void;
};
declare abstract class BaseConnection<T extends ValidEventTypes> extends EventEmitter<T & BaseConnectionEvents> {
readonly peer: string;

@@ -138,6 +137,16 @@ provider: Peer;

}
type DataConnectionEvents = {
/**
* Emitted when data is received from the remote peer.
*/
data: (data: unknown) => void;
/**
* Emitted when the connection is established and ready-to-use.
*/
open: () => void;
};
/**
* Wraps a DataChannel between two Peers.
*/
export class DataConnection extends BaseConnection implements DataConnection {
export class DataConnection extends BaseConnection<DataConnectionEvents> implements DataConnection {
readonly label: string;

@@ -187,6 +196,12 @@ readonly serialization: SerializationType;

}
type MediaConnectionEvents = {
/**
* Emitted when a connection to the PeerServer is established.
*/
stream: (stream: MediaStream) => void;
};
/**
* Wraps the streaming interface between two Peers.
*/
export class MediaConnection extends BaseConnection {
export class MediaConnection extends BaseConnection<MediaConnectionEvents> {
get type(): ConnectionType;

@@ -198,3 +213,3 @@ get localStream(): MediaStream;

handleMessage(message: ServerMessage): void;
answer(stream: MediaStream, options?: AnswerOption): void;
answer(stream?: MediaStream, options?: AnswerOption): void;
/**

@@ -301,5 +316,5 @@ * Exposed functionality for users.

call(peer: string, stream: MediaStream, options?: CallOption): MediaConnection;
_removeConnection(connection: BaseConnection): void;
_removeConnection(connection: DataConnection | MediaConnection): void;
/** Retrieve a data/media connection for this peer. */
getConnection(peerId: string, connectionId: string): null | BaseConnection;
getConnection(peerId: string, connectionId: string): null | DataConnection | MediaConnection;
/** Emits a typed error message. */

@@ -306,0 +321,0 @@ emitError(type: PeerErrorType, err: string | Error): void;

{
"name": "peerjs",
"version": "1.4.6-rc.1",
"version": "1.4.6",
"keywords": [

@@ -5,0 +5,0 @@ "peerjs",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc