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

socket.io

Package Overview
Dependencies
Maintainers
2
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

1

lib/index.js

@@ -373,2 +373,3 @@ 'use strict';

debug('serve client source');
res.setHeader("Cache-Control", "public, max-age=0");
res.setHeader('Content-Type', 'application/javascript');

@@ -375,0 +376,0 @@ res.setHeader('ETag', expectedEtag);

@@ -265,2 +265,5 @@

Namespace.prototype.clients = function(fn){
if(!this.adapter){
throw new Error('No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?')
}
this.adapter.clients(this.rooms, fn);

@@ -267,0 +270,0 @@ // reset rooms for scenario:

10

package.json
{
"name": "socket.io",
"version": "2.1.1",
"version": "2.2.0",
"description": "node.js realtime framework server",

@@ -27,8 +27,8 @@ "keywords": [

"dependencies": {
"debug": "~3.1.0",
"engine.io": "~3.2.0",
"debug": "~4.1.0",
"engine.io": "~3.3.1",
"has-binary2": "~1.0.2",
"socket.io-adapter": "~1.1.0",
"socket.io-client": "2.1.1",
"socket.io-parser": "~3.2.0"
"socket.io-client": "2.2.0",
"socket.io-parser": "~3.3.0"
},

@@ -35,0 +35,0 @@ "devDependencies": {

@@ -14,3 +14,3 @@

Socket.IO enables real-time bidirectional event-based communication. It consists in:
Socket.IO enables real-time bidirectional event-based communication. It consists of:

@@ -59,6 +59,6 @@ - a Node.js server (this repository)

```js
io.on('connection', function(socket){
socket.emit('request', /* */); // emit an event to the socket
io.emit('broadcast', /* */); // emit an event to all connected sockets
socket.on('reply', function(){ /* */ }); // listen to the event
io.on('connection', socket => {
socket.emit('request', /* … */); // emit an event to the socket
io.emit('broadcast', /* … */); // emit an event to all connected sockets
socket.on('reply', () => { /* … */ }); // listen to the event
});

@@ -89,3 +89,3 @@ ```

```bash
npm install socket.io --save
npm install socket.io
```

@@ -99,7 +99,7 @@

```js
var server = require('http').createServer();
var io = require('socket.io')(server);
io.on('connection', function(client){
client.on('event', function(data){});
client.on('disconnect', function(){});
const server = require('http').createServer();
const io = require('socket.io')(server);
io.on('connection', client => {
client.on('event', data => { /* … */ });
client.on('disconnect', () => { /* … */ });
});

@@ -112,4 +112,4 @@ server.listen(3000);

```js
var io = require('socket.io')();
io.on('connection', function(client){});
const io = require('socket.io')();
io.on('connection', client => { ... });
io.listen(3000);

@@ -126,6 +126,6 @@ ```

```js
var app = require('express')();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
io.on('connection', function(){ /* … */ });
const app = require('express')();
const server = require('http').createServer(app);
const io = require('socket.io')(server);
io.on('connection', () => { /* … */ });
server.listen(3000);

@@ -140,6 +140,6 @@ ```

```js
var app = require('koa')();
var server = require('http').createServer(app.callback());
var io = require('socket.io')(server);
io.on('connection', function(){ /* … */ });
const app = require('koa')();
const server = require('http').createServer(app.callback());
const io = require('socket.io')(server);
io.on('connection', () => { /* … */ });
server.listen(3000);

@@ -146,0 +146,0 @@ ```

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