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.3 to 6.0.4

LICENSE.txt

8

lib/index.d.ts

@@ -9,8 +9,8 @@ import { Observable } from 'rxjs';

send(data: string | ArrayBuffer | Blob): any;
onopen?: (event: Event) => any;
onclose?: (event: CloseEvent) => any;
onmessage?: (event: MessageEvent) => any;
onerror?: (event: ErrorEvent) => any;
onopen: ((event: any) => any) | null;
onclose: ((event: any) => any) | null;
onmessage: ((event: any) => any) | null;
onerror: ((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;

@@ -36,3 +36,3 @@ "use strict";

closed();
observer.error(error);
observer.error(new Error(error.message));
};

@@ -39,0 +39,0 @@ socket.onclose = function (event) {

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {

@@ -7,0 +10,0 @@ extendStatics(d, b);

{
"name": "rxjs-websockets",
"version": "6.0.3",
"version": "6.0.4",
"description": "rxjs 5 websockets library, ideal for use with angular 2",

@@ -41,4 +41,4 @@ "main": "lib/index.js",

"sinon-chai": "^2.13.0",
"typescript": "^2.1.6"
"typescript": "^3.2.0"
}
}
import { Observable, Subscription, BehaviorSubject } from 'rxjs'
export interface Connection {
connectionStatus: Observable<number>,
messages: Observable<string>,
connectionStatus: Observable<number>
messages: Observable<string>
}
interface EventWithReason {
reason: string
}
interface EventWithData {
// TODO: should be
// data: string | ArrayBuffer | Blob;
data: string
}
interface EventWithMessage {
message?: string
}
export interface IWebSocket {
close()
send(data: string | ArrayBuffer | Blob)
onopen?: (event: Event) => any
onclose?: (event: CloseEvent) => any
onmessage?: (event: MessageEvent) => any
onerror?: (event: ErrorEvent) => any
close(): any
send(data: string | ArrayBuffer | Blob): any
// TypeScript doesn't seem to apply function bivariance on each property when
// comparing an object to an interface so the argument types have to be `any` :(
// Ideally would be able to use the EventWith... interfaces
onopen: ((event: any) => any) | null
onclose: ((event: any) => any) | null
onmessage: ((event: any) => any) | null
onerror: ((event: any) => any) | null
}

@@ -54,12 +72,12 @@

socket.onmessage = (message: MessageEvent) => {
socket.onmessage = (message: EventWithData) => {
observer.next(message.data)
}
socket.onerror = (error: ErrorEvent) => {
socket.onerror = (error: EventWithMessage) => {
closed()
observer.error(error)
observer.error(new Error(error.message))
}
socket.onclose = (event: CloseEvent) => {
socket.onclose = (event: EventWithReason) => {
// prevent observer.complete() being called after observer.error(...)

@@ -66,0 +84,0 @@ if (! open)

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

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