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

ngx-socket-io

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-socket-io - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

index.ngsummary.json

26

bundles/socketio.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/Observable'), require('rxjs/add/operator/share'), require('socket.io-client')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs/Observable', 'rxjs/add/operator/share', 'socket.io-client'], factory) :
(factory((global.ng = global.ng || {}, global.ng.socketio = global.ng.socketio || {}),global.ng.core,global.Rx,null,global.io));
}(this, (function (exports,_angular_core,rxjs_Observable,rxjs_add_operator_share,io) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('socket.io-client')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs', 'socket.io-client'], factory) :
(factory((global.ng = global.ng || {}, global.ng.socketio = global.ng.socketio || {}),global.ng.core,global.rxjs,global.io));
}(this, (function (exports,_angular_core,rxjs,io) { 'use strict';

@@ -47,3 +47,3 @@ var io__default = io['default'];

this.subscribersCounter++;
return rxjs_Observable.Observable.create(function (observer) {
return rxjs.Observable.create(function (observer) {
_this.ioSocket.on(eventName, function (data) {

@@ -62,8 +62,8 @@ observer.next(data);

};
/** @nocollapse */
WrappedSocket.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [SOCKET_CONFIG_TOKEN,] },] },
]; };
return WrappedSocket;
}());
/** @nocollapse */
WrappedSocket.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [SOCKET_CONFIG_TOKEN,] },] },
]; };

@@ -91,9 +91,7 @@ /** Socket factory */

};
SocketIoModule.decorators = [
{ type: _angular_core.NgModule, args: [{},] },
];
return SocketIoModule;
}());
SocketIoModule.decorators = [
{ type: _angular_core.NgModule, args: [{},] },
];
/** @nocollapse */
SocketIoModule.ctorParameters = function () { return []; };

@@ -100,0 +98,0 @@ exports.SocketIoModule = SocketIoModule;

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/operator/share"),require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/Observable","rxjs/add/operator/share","socket.io-client"],t):t((e.ng=e.ng||{},e.ng.socketio=e.ng.socketio||{}),e.ng.core,e.Rx,null,e.io)}(this,function(e,t,o,r,n){"use strict";function i(e){return new s(e)}var c=n.default,s=function(){function e(e){this.subscribersCounter=0,this.emptyConfig={url:"",options:{}},void 0===e&&(e=this.emptyConfig);var t=e.url,o=e.options,r=c||n;this.ioSocket=r(t,o)}return e.prototype.on=function(e,t){this.ioSocket.on(e,t)},e.prototype.once=function(e,t){this.ioSocket.once(e,t)},e.prototype.connect=function(){return this.ioSocket.connect()},e.prototype.disconnect=function(e){return this.ioSocket.disconnect.apply(this.ioSocket,arguments)},e.prototype.emit=function(e,t,o){return this.ioSocket.emit.apply(this.ioSocket,arguments)},e.prototype.removeListener=function(e,t){return this.ioSocket.removeListener.apply(this.ioSocket,arguments)},e.prototype.removeAllListeners=function(e){return this.ioSocket.removeAllListeners.apply(this.ioSocket,arguments)},e.prototype.fromEvent=function(e){var t=this;return this.subscribersCounter++,o.Observable.create(function(o){return t.ioSocket.on(e,function(e){o.next(e)}),function(){1===t.subscribersCounter&&t.ioSocket.removeListener(e)}}).share()},e.prototype.fromOneTimeEvent=function(e){var t=this;return new Promise(function(o){return t.once(e,o)})},e}();s.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[u]}]}]};var u=new t.InjectionToken("__SOCKET_IO_CONFIG__"),p=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:u,useValue:t},{provide:s,useFactory:i,deps:[u]}]}},e}();p.decorators=[{type:t.NgModule,args:[{}]}],p.ctorParameters=function(){return[]},e.SocketIoModule=p,e.Socket=s,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","socket.io-client"],t):t((e.ng=e.ng||{},e.ng.socketio=e.ng.socketio||{}),e.ng.core,e.rxjs,e.io)}(this,function(e,t,o,n){"use strict";function r(e){return new c(e)}var i=n.default,c=function(){function e(e){this.subscribersCounter=0,this.emptyConfig={url:"",options:{}},void 0===e&&(e=this.emptyConfig);var t=e.url,o=e.options,r=i||n;this.ioSocket=r(t,o)}return e.prototype.on=function(e,t){this.ioSocket.on(e,t)},e.prototype.once=function(e,t){this.ioSocket.once(e,t)},e.prototype.connect=function(){return this.ioSocket.connect()},e.prototype.disconnect=function(e){return this.ioSocket.disconnect.apply(this.ioSocket,arguments)},e.prototype.emit=function(e,t,o){return this.ioSocket.emit.apply(this.ioSocket,arguments)},e.prototype.removeListener=function(e,t){return this.ioSocket.removeListener.apply(this.ioSocket,arguments)},e.prototype.removeAllListeners=function(e){return this.ioSocket.removeAllListeners.apply(this.ioSocket,arguments)},e.prototype.fromEvent=function(e){var t=this;return this.subscribersCounter++,o.Observable.create(function(o){return t.ioSocket.on(e,function(e){o.next(e)}),function(){1===t.subscribersCounter&&t.ioSocket.removeListener(e)}}).share()},e.prototype.fromOneTimeEvent=function(e){var t=this;return new Promise(function(o){return t.once(e,o)})},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s]}]}]},e}(),s=new t.InjectionToken("__SOCKET_IO_CONFIG__"),u=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:s,useValue:t},{provide:c,useFactory:r,deps:[s]}]}},e.decorators=[{type:t.NgModule,args:[{}]}],e}();e.SocketIoModule=u,e.Socket=c,Object.defineProperty(e,"__esModule",{value:!0})});

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

[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./src/socket-io.module","export":["SocketIoModule"]},{"from":"./src/config/socket-io.config","export":["SocketIoConfig"]},{"from":"./src/socket-io.service","export":[{"name":"WrappedSocket","as":"Socket"}]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./src/socket-io.module","export":["SocketIoModule"]},{"from":"./src/config/socket-io.config","export":["SocketIoConfig"]},{"from":"./src/socket-io.service","export":[{"name":"WrappedSocket","as":"Socket"}]}]}]
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./src/socket-io.module","export":["SocketIoModule"]},{"from":"./src/config/socket-io.config","export":["SocketIoConfig"]},{"from":"./src/socket-io.service","export":[{"name":"WrappedSocket","as":"Socket"}]}]}]
{
"name": "ngx-socket-io",
"version": "1.0.8",
"description": "Socket.IO module for Angular 4",
"version": "1.1.0",
"description": "Socket.IO module for Angular 6",
"main": "index.ts",

@@ -27,5 +27,6 @@ "scripts": {

"dependencies": {
"@angular/core": "^6.0.4",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.0",
"rxjs": "^6.1.0",
"socket.io": "^2.0.1",

@@ -36,3 +37,5 @@ "socket.io-client": "^2.0.1",

"peerDependencies": {
"@angular/core": "^5.0.0"
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0",
"rxjs": "^6.0.0"
},

@@ -51,5 +54,5 @@ "devDependencies": {

"tslint": "^5.4.0",
"typescript": "^2.3.4",
"typescript": "^2.4.2",
"uglify-js": "^3.0.14"
}
}

@@ -38,2 +38,33 @@ # ngx-socket-io

### For Angular 6 Project in version 1.0.8
To be sure that you are using Angular 6, check your version:
```bash
ng -v
```
If you are using Angular 6 you need change two thing
1. Install rxjs-compat
```bash
npm install rxjs-compat
```
2. Change polyfills.ts
Add this code in the first line of the file:
```ts
(window as any).global = window;
```
### Using your socket Instance

@@ -44,2 +75,3 @@

```typescript
import { Injectable } from '@angular/core';

@@ -56,4 +88,3 @@ import { Socket } from 'ngx-socket-io';

}
getMessage() {
getMessage() {
return this.socket

@@ -64,2 +95,3 @@ .fromEvent("message")

}
```

@@ -72,2 +104,3 @@

```typescript
import { Injectable, NgModule } from '@angular/core';

@@ -106,3 +139,3 @@ import { Socket } from 'ngx-socket-io';

export class AppModule { }
```

@@ -120,2 +153,3 @@

### `socket.on(eventName: string)`
Takes an event name and callback.

@@ -125,2 +159,3 @@ Works the same as in Socket.IO.

### `socket.removeListener(eventName: string, callback: Function)`
Takes an event name and callback.

@@ -130,2 +165,3 @@ Works the same as in Socket.IO.

### `socket.removeAllListeners(eventName: string)`
Takes an event name.

@@ -135,2 +171,3 @@ Works the same as in Socket.IO.

### `socket.emit(eventName:string, message?: any, [callback: Function])`
Sends a message to the server.

@@ -141,5 +178,7 @@ Optionally takes a callback.

### `socket.fromEvent<T>(eventName: string): Observable<T>`
Takes an event name and returns an Observable that you can subscribe to.
### `socket.fromEventOnce<T>(eventName: string): Promise<T>`
Creates a Promise for a one-time event.

@@ -146,0 +185,0 @@

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

[{"__symbolic":"module","version":3,"metadata":{"SocketIoConfig":{"__symbolic":"interface"}}},{"__symbolic":"module","version":1,"metadata":{"SocketIoConfig":{"__symbolic":"interface"}}}]
[{"__symbolic":"module","version":4,"metadata":{"SocketIoConfig":{"__symbolic":"interface"}}}]

@@ -24,10 +24,8 @@ import { NgModule, InjectionToken } from '@angular/core';

};
SocketIoModule.decorators = [
{ type: NgModule, args: [{},] },
];
return SocketIoModule;
}());
export { SocketIoModule };
SocketIoModule.decorators = [
{ type: NgModule, args: [{},] },
];
/** @nocollapse */
SocketIoModule.ctorParameters = function () { return []; };
//# sourceMappingURL=socket-io.module.js.map

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

[{"__symbolic":"module","version":3,"metadata":{"SocketFactory":{"__symbolic":"function","parameters":["config"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket"},"arguments":[{"__symbolic":"reference","name":"config"}]}},"SOCKET_CONFIG_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["__SOCKET_IO_CONFIG__"]},"SocketIoModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"SocketIoModule"},"providers":[{"provide":{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"},"useValue":{"__symbolic":"reference","name":"config"}},{"provide":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket"},"useFactory":{"__symbolic":"reference","name":"SocketFactory"},"deps":[{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"}]}]}}}}}},{"__symbolic":"module","version":1,"metadata":{"SocketFactory":{"__symbolic":"function","parameters":["config"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket"},"arguments":[{"__symbolic":"reference","name":"config"}]}},"SOCKET_CONFIG_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["__SOCKET_IO_CONFIG__"]},"SocketIoModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"SocketIoModule"},"providers":[{"provide":{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"},"useValue":{"__symbolic":"reference","name":"config"}},{"provide":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket"},"useFactory":{"__symbolic":"reference","name":"SocketFactory"},"deps":[{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"}]}]}}}}}}]
[{"__symbolic":"module","version":4,"metadata":{"SocketFactory":{"__symbolic":"function","parameters":["config"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket","line":6,"character":15},"arguments":[{"__symbolic":"reference","name":"config"}]}},"SOCKET_CONFIG_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":39},"arguments":["__SOCKET_IO_CONFIG__"]},"SocketIoModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"SocketIoModule"},"providers":[{"provide":{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"},"useValue":{"__symbolic":"reference","name":"config"}},{"provide":{"__symbolic":"reference","module":"./socket-io.service","name":"WrappedSocket","line":19,"character":29},"useFactory":{"__symbolic":"reference","name":"SocketFactory"},"deps":[{"__symbolic":"reference","name":"SOCKET_CONFIG_TOKEN"}]}]}}}}}}]

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

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/share';
import { Observable } from 'rxjs';
import { SocketIoConfig } from './config/socket-io.config';

@@ -4,0 +3,0 @@ export declare class WrappedSocket {

import { Inject } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/share';
import { Observable } from 'rxjs';
import * as io from 'socket.io-client';

@@ -58,9 +57,9 @@ import { SOCKET_CONFIG_TOKEN } from './socket-io.module';

};
/** @nocollapse */
WrappedSocket.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [SOCKET_CONFIG_TOKEN,] },] },
]; };
return WrappedSocket;
}());
export { WrappedSocket };
/** @nocollapse */
WrappedSocket.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [SOCKET_CONFIG_TOKEN,] },] },
]; };
//# sourceMappingURL=socket-io.service.js.map

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

[{"__symbolic":"module","version":3,"metadata":{"WrappedSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./socket-io.module","name":"SOCKET_CONFIG_TOKEN"}]}]],"parameters":[{"__symbolic":"reference","module":"./config/socket-io.config","name":"SocketIoConfig"}]}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"WrappedSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./socket-io.module","name":"SOCKET_CONFIG_TOKEN"}]}]],"parameters":[{"__symbolic":"reference","module":"./config/socket-io.config","name":"SocketIoConfig"}]}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":4,"metadata":{"WrappedSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":17,"character":17},"arguments":[{"__symbolic":"reference","module":"./socket-io.module","name":"SOCKET_CONFIG_TOKEN","line":17,"character":24}]}]],"parameters":[{"__symbolic":"reference","module":"./config/socket-io.config","name":"SocketIoConfig","line":17,"character":53}]}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}}]

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