Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rxjs-websockets

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-websockets - npm Package Compare versions

Comparing version 6.0.4 to 7.0.0-alpha.1

changelog.markdown

10

lib/index.d.ts
import { Observable } from 'rxjs';
export interface Connection {
declare type WebSocketPayload = string | ArrayBuffer | Blob;
export interface Connection<T extends WebSocketPayload = WebSocketPayload> {
connectionStatus: Observable<number>;
messages: Observable<string>;
messages: Observable<T>;
}
export interface IWebSocket {
close(): any;
send(data: string | ArrayBuffer | Blob): any;
send(data: WebSocketPayload): any;
onopen: ((event: any) => any) | null;

@@ -15,2 +16,3 @@ onclose: ((event: any) => any) | null;

export declare type WebSocketFactory = (url: string, protocols?: string | string[]) => IWebSocket;
export default function connect(url: string, input: Observable<string>, protocols?: string | string[], websocketFactory?: WebSocketFactory): Connection;
export default function connect<T extends WebSocketPayload = WebSocketPayload>(url: string, input: Observable<WebSocketPayload>, protocols?: string | string[], websocketFactory?: WebSocketFactory): Connection<T>;
export {};

2

package.json
{
"name": "rxjs-websockets",
"version": "6.0.4",
"version": "7.0.0-alpha.1",
"description": "rxjs 5 websockets library, ideal for use with angular 2",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

import { Observable, Subscription, BehaviorSubject } from 'rxjs'
export interface Connection {
connectionStatus: Observable<number>
messages: Observable<string>
}
interface EventWithReason {

@@ -12,8 +7,2 @@ reason: string

interface EventWithData {
// TODO: should be
// data: string | ArrayBuffer | Blob;
data: string
}
interface EventWithMessage {

@@ -23,5 +12,12 @@ message?: string

type WebSocketPayload = string | ArrayBuffer | Blob
export interface Connection<T extends WebSocketPayload = WebSocketPayload> {
connectionStatus: Observable<number>,
messages: Observable<T>,
}
export interface IWebSocket {
close(): any
send(data: string | ArrayBuffer | Blob): any
send(data: WebSocketPayload): any

@@ -43,11 +39,11 @@ // TypeScript doesn't seem to apply function bivariance on each property when

export default function connect(
export default function connect<T extends WebSocketPayload = WebSocketPayload>(
url: string,
input: Observable<string>,
input: Observable<WebSocketPayload>,
protocols: string | string[] = defaultProtocols,
websocketFactory: WebSocketFactory = defaultWebsocketFactory,
): Connection {
): Connection<T> {
const connectionStatus = new BehaviorSubject<number>(0)
const messages = new Observable<string>(observer => {
const messages = new Observable<T>(observer => {
const socket = websocketFactory(url, protocols)

@@ -75,3 +71,3 @@ let inputSubscription: Subscription

socket.onmessage = (message: EventWithData) => {
socket.onmessage = (message: { data: T }) => {
observer.next(message.data)

@@ -78,0 +74,0 @@ }

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