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

@yomo/presence

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yomo/presence - npm Package Compare versions

Comparing version 2.1.0-alpha1 to 2.1.1

114

dist/index.d.ts
declare global {
interface Window {
WebTransport: any;
}
interface Window {
WebTransport: any;
}
}
declare type State = {
id: string;
[key: string]: any;
type State = {
id: string;
[key: string]: any;
};
declare type PresenceOptions = {
url?: string;
id?: string;
publicKey?: string;
appId?: string;
appSecret?: string;
endpoint?: string;
reliable?: boolean;
debug?: boolean;
type PresenceOptions = {
id?: string;
publicKey?: string;
reliable?: boolean; // default: false
debug?: boolean; // default: false
autoDowngrade?: boolean; // default: false
};
declare type InternalPresenceOptions = {
url: string;
id: string;
reliable: boolean;
publicKey?: string;
appId?: string;
appSecret?: string;
endpoint?: string;
debug?: boolean;
// internal options, create presence instance with this options
type InternalPresenceOptions = {
id: string;
reliable: boolean;
publicKey?: string;
debug: boolean;
autoDowngrade: boolean;
};
/**
* @param onReady - callback function when the presence instance is ready
* @param onError - callback function when the presence instance is error
* @param onClosed - callback function when the presence instance is closed
*/
interface IPresence {
onReady(callbackFn: (presence: IPresence) => void): void;
joinChannel: (channelId: string, metadata?: State) => IChannel;
leaveChannel: (channelId: string) => void;
onReady(callbackFn: (presence: IPresence) => void): void;
/**
* join a channel
* @param channelId a unique channel id
* @param state join channel initial state
* @returns {Channel}
*/
joinChannel: (channelId: string, metadata?: State) => IChannel;
leaveChannel: (channelId: string) => void;
}
declare type Peers = State[];
declare type PeersSubscribeCallbackFn = (peers: Peers) => any;
declare type PeersUnsubscribe = Function;
declare type Unsubscribe = Function;
declare type PeersSubscribe = (callbackFn: PeersSubscribeCallbackFn) => PeersUnsubscribe;
declare type ChannelEventSubscribeCallbackFn<T> = (payload: T, state: State) => any;
type Peers = State[];
type PeersSubscribeCallbackFn = (peers: Peers) => any;
type PeersUnsubscribe = Function;
type Unsubscribe = Function;
type PeersSubscribe = (
callbackFn: PeersSubscribeCallbackFn
) => PeersUnsubscribe;
type ChannelEventSubscribeCallbackFn<T> = (
payload: T,
state: State
) => any;
interface IChannel {
id: string;
broadcast<T>(eventName: string, payload: T): void;
subscribe<T>(eventName: string, callbackFn: ChannelEventSubscribeCallbackFn<T>): Unsubscribe;
subscribePeers: PeersSubscribe;
leave(): void;
id: string;
broadcast<T>(eventName: string, payload: T): void;
subscribe<T>(
eventName: string,
callbackFn: ChannelEventSubscribeCallbackFn<T>
): Unsubscribe;
subscribePeers: PeersSubscribe;
leave(): void;
}

@@ -64,11 +86,21 @@

#private;
constructor(options: InternalPresenceOptions);
constructor(url: string, options: InternalPresenceOptions);
onReady(callbackFn: Function): void;
onError(callbackFn: Function): void;
onClosed(callbackFn: Function): void;
joinChannel(channelId: string, metadata?: State): Channel;
joinChannel(channelId: string, state?: State): Channel;
leaveChannel(channelId: string): void;
}
declare function createPresence(options: PresenceOptions): Promise<IPresence>;
/**
* create a presence instance
* @param url backend url
* @param {string} options.id - the id of the presence instance
* @param {string} options.publicKey - the public key of the presence instance
* @param {boolean} options.reliable - whether to use reliable transport
* @param {boolean} options.debug - whether to enable debug mode
* @param {boolean} options.autoDowngrade - whether to auto downgrade to unreliable transport, when the reliable transport is not available
* @returns {Promise<IPresence>}
*/
declare function createPresence(url: string, options: PresenceOptions): Promise<IPresence>;
export { IChannel, IPresence, Presence, createPresence };
{
"name": "@yomo/presence",
"version": "2.1.0-alpha1",
"description": "Edge Infra for Realtime Web Applications, geo-distributed architecture ⚡️",
"license": "MIT",
"keywords": [
"webtransport",
"websocket",
"presence",
"live",
"realtime"
],
"module": "./dist/index.js",
"typings": "./dist/index.d.ts",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
"name": "@yomo/presence",
"version": "2.1.1",
"description": "Edge Infra for Realtime Web Applications, geo-distributed architecture ⚡️",
"license": "MIT",
"keywords": [
"webtransport",
"websocket",
"presence",
"live",
"realtime"
],
"module": "./dist/index.js",
"typings": "./dist/index.d.ts",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"devDependencies": {
"@msgpack/msgpack": "^2.8.0",
"@types/node-fetch": "^2.5.12",
"node-fetch": "^2.6.7",
"tsdx": "^0.14.1",
"tsup": "^6.2.2",
"typescript": "^4.5.2",
"web-streams-polyfill": "^3.2.1"
},
"repository": "github.com:yomorun/presencejs",
"bugs": {
"url": "https://github.com/yomorun/presencejs/issues"
},
"homepage": "https://presence.js.org",
"dependencies": {
"@yomo/webtransport-polyfill": "^1.0.1"
},
"scripts": {
"start": "tsup ./src/index.ts --dts --watch",
"build": "tsup ./src/index.ts --dts",
"test": "tsdx test --detectOpenHandles",
"lint": "tsdx lint"
}
"./package.json": "./package.json"
},
"repository": "github.com:yomorun/presencejs",
"bugs": {
"url": "https://github.com/yomorun/presencejs/issues"
},
"homepage": "https://presence.js.org",
"devDependencies": {
"@msgpack/msgpack": "^2.8.0",
"@types/node-fetch": "^2.5.12",
"node-fetch": "^2.6.7",
"tsdx": "^0.14.1",
"tsup": "^6.2.2",
"typescript": "^4.5.2",
"web-streams-polyfill": "^3.2.1"
},
"dependencies": {
"@yomo/webtransport-polyfill": "^1.0.1"
},
"scripts": {
"start": "tsup ./src/index.ts --dts --watch",
"build": "tsup ./src/index.ts --dts",
"test": "tsdx test --detectOpenHandles",
"lint": "tsdx lint"
}
}
## 🧬 Introduction
![](https://badgen.net/npm/v/@yomo/presence)
`Presencejs` is a JavaScript library that enables the creation of real-time web applications with a secure, low-latency, and high-performance geo-distributed architecture.

@@ -4,0 +6,0 @@

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 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