Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: socketio/socket.io
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0abbd4da50c3fbffa5e32359b269e96c156c6ef2
Choose a base ref
...
head repository: socketio/socket.io
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1af3267e3f5f7884214cf2ca4d5282d620092fb0
Choose a head ref
Loading
Showing with 40,320 additions and 5,068 deletions.
  1. +8 −1 .github/ISSUE_TEMPLATE.md
  2. +2 −1 .gitignore
  3. +6 −24 .travis.yml
  4. +262 −0 CHANGELOG.md
  5. +0 −638 History.md
  6. +1 −1 LICENSE
  7. +0 −8 Makefile
  8. +174 −405 Readme.md
  9. +6,161 −0 client-dist/socket.io.js
  10. +1 −0 client-dist/socket.io.js.map
  11. +7 −0 client-dist/socket.io.min.js
  12. +1 −0 client-dist/socket.io.min.js.map
  13. +7 −0 client-dist/socket.io.msgpack.min.js
  14. +1 −0 client-dist/socket.io.msgpack.min.js.map
  15. +2 −0 docs/README.md
  16. +1 −4 examples/chat/README.md
  17. +10 −9 examples/chat/index.js
  18. +706 −0 examples/chat/package-lock.json
  19. +2 −1 examples/chat/package.json
  20. +27 −27 examples/chat/public/main.js
  21. +31 −0 examples/cluster-haproxy/README.md
  22. +51 −0 examples/cluster-haproxy/docker-compose.yml
  23. +2 −0 examples/cluster-haproxy/haproxy/Dockerfile
  24. +31 −0 examples/cluster-haproxy/haproxy/haproxy.cfg
  25. +15 −0 examples/cluster-haproxy/server/Dockerfile
  26. +87 −0 examples/cluster-haproxy/server/index.js
  27. +17 −0 examples/cluster-haproxy/server/package.json
  28. +28 −0 examples/cluster-haproxy/server/public/index.html
  29. +286 −0 examples/cluster-haproxy/server/public/main.js
  30. +149 −0 examples/cluster-haproxy/server/public/style.css
  31. +31 −0 examples/cluster-httpd/README.md
  32. +51 −0 examples/cluster-httpd/docker-compose.yml
  33. +2 −0 examples/cluster-httpd/httpd/Dockerfile
  34. +52 −0 examples/cluster-httpd/httpd/httpd.conf
  35. +15 −0 examples/cluster-httpd/server/Dockerfile
  36. +82 −0 examples/cluster-httpd/server/index.js
  37. +17 −0 examples/cluster-httpd/server/package.json
  38. +28 −0 examples/cluster-httpd/server/public/index.html
  39. +286 −0 examples/cluster-httpd/server/public/main.js
  40. +149 −0 examples/cluster-httpd/server/public/style.css
  41. +31 −0 examples/cluster-nginx/README.md
  42. +51 −0 examples/cluster-nginx/docker-compose.yml
  43. +3 −0 examples/cluster-nginx/nginx/Dockerfile
  44. +35 −0 examples/cluster-nginx/nginx/nginx.conf
  45. +15 −0 examples/cluster-nginx/server/Dockerfile
  46. +82 −0 examples/cluster-nginx/server/index.js
  47. +17 −0 examples/cluster-nginx/server/package.json
  48. +28 −0 examples/cluster-nginx/server/public/index.html
  49. +286 −0 examples/cluster-nginx/server/public/main.js
  50. +149 −0 examples/cluster-nginx/server/public/style.css
  51. +23 −0 examples/create-react-app-example/.gitignore
  52. +72 −0 examples/create-react-app-example/README.md
  53. +37 −0 examples/create-react-app-example/package.json
  54. BIN examples/create-react-app-example/public/favicon.ico
  55. +43 −0 examples/create-react-app-example/public/index.html
  56. BIN examples/create-react-app-example/public/logo192.png
  57. BIN examples/create-react-app-example/public/logo512.png
  58. +25 −0 examples/create-react-app-example/public/manifest.json
  59. +3 −0 examples/create-react-app-example/public/robots.txt
  60. +19 −0 examples/create-react-app-example/server.js
  61. +38 −0 examples/create-react-app-example/src/App.css
  62. +43 −0 examples/create-react-app-example/src/App.js
  63. +9 −0 examples/create-react-app-example/src/App.test.js
  64. +13 −0 examples/create-react-app-example/src/index.css
  65. +17 −0 examples/create-react-app-example/src/index.js
  66. +7 −0 examples/create-react-app-example/src/logo.svg
  67. +141 −0 examples/create-react-app-example/src/serviceWorker.js
  68. +5 −0 examples/create-react-app-example/src/setupTests.js
  69. +11,106 −0 examples/create-react-app-example/yarn.lock
  70. +50 −0 examples/custom-parsers/README.md
  71. +21 −0 examples/custom-parsers/package.json
  72. +13 −0 examples/custom-parsers/public/index.html
  73. +8 −0 examples/custom-parsers/src/client1.js
  74. +11 −0 examples/custom-parsers/src/client2.js
  75. +11 −0 examples/custom-parsers/src/client3.js
  76. +11 −0 examples/custom-parsers/src/client4.js
  77. +125 −0 examples/custom-parsers/src/custom-parser.js
  78. +55 −0 examples/custom-parsers/src/server.js
  79. +15 −0 examples/custom-parsers/support/webpack.config.js
  80. +17 −0 examples/es-modules/README.md
  81. +18 −0 examples/es-modules/client.js
  82. +238 −0 examples/es-modules/package-lock.json
  83. +15 −0 examples/es-modules/package.json
  84. +16 −0 examples/es-modules/server.js
  85. +14 −0 examples/passport-example/README.md
  86. BIN examples/passport-example/assets/passport_example.gif
  87. +31 −0 examples/passport-example/index.html
  88. +104 −0 examples/passport-example/index.js
  89. +24 −0 examples/passport-example/login.html
  90. +783 −0 examples/passport-example/package-lock.json
  91. +16 −0 examples/passport-example/package.json
  92. +4 −0 examples/react-native/.expo-shared/assets.json
  93. +14 −0 examples/react-native/.gitignore
  94. +71 −0 examples/react-native/App.js
  95. +16 −0 examples/react-native/README.md
  96. +28 −0 examples/react-native/app.json
  97. BIN examples/react-native/assets/icon.png
  98. BIN examples/react-native/assets/react-native-demo.gif
  99. BIN examples/react-native/assets/react-native.png
  100. BIN examples/react-native/assets/splash.png
  101. +6 −0 examples/react-native/babel.config.js
  102. +6,775 −0 examples/react-native/package-lock.json
  103. +24 −0 examples/react-native/package.json
  104. +15 −0 examples/react-native/server.js
  105. +30 −0 examples/tweet-stream/index.js
  106. +705 −0 examples/tweet-stream/package-lock.json
  107. +20 −0 examples/tweet-stream/package.json
  108. +19 −0 examples/typescript/client.ts
  109. +268 −0 examples/typescript/package-lock.json
  110. +17 −0 examples/typescript/package.json
  111. +16 −0 examples/typescript/server.ts
  112. +18 −0 examples/webpack-build-server/README.md
  113. +16 −0 examples/webpack-build-server/lib/index.js
  114. +4,137 −0 examples/webpack-build-server/package-lock.json
  115. +16 −0 examples/webpack-build-server/package.json
  116. +9 −0 examples/webpack-build-server/support/webpack.config.js
  117. +20 −0 examples/webpack-build/README.md
  118. +13 −0 examples/webpack-build/index.html
  119. +12 −0 examples/webpack-build/lib/index.js
  120. +21 −0 examples/webpack-build/package.json
  121. +2 −0 examples/webpack-build/support/noop.js
  122. +8 −0 examples/webpack-build/support/webpack.config.js
  123. +33 −0 examples/webpack-build/support/webpack.config.json-parser.js
  124. +31 −0 examples/webpack-build/support/webpack.config.slim.js
  125. +17 −0 examples/whiteboard/README.md
  126. +16 −0 examples/whiteboard/index.js
  127. +706 −0 examples/whiteboard/package-lock.json
  128. +19 −0 examples/whiteboard/package.json
  129. +23 −0 examples/whiteboard/public/index.html
  130. +106 −0 examples/whiteboard/public/main.js
  131. +44 −0 examples/whiteboard/public/style.css
  132. +0 −69 gulpfile.js
  133. +0 −254 lib/client.js
  134. +278 −0 lib/client.ts
  135. +0 −443 lib/index.js
  136. +715 −0 lib/index.ts
  137. +0 −275 lib/namespace.js
  138. +291 −0 lib/namespace.ts
  139. +40 −0 lib/parent-namespace.ts
  140. +0 −546 lib/socket.js
  141. +595 −0 lib/socket.ts
  142. +40 −23 package.json
  143. +0 −11 test/fixtures/server-close.js
  144. +11 −0 test/fixtures/server-close.ts
  145. +0 −2,328 test/socket.io.js
  146. +2,334 −0 test/socket.io.ts
  147. +22 −0 test/support/util.ts
  148. +13 −0 tsconfig.json
  149. +3 −0 wrapper.mjs
9 changes: 8 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

*Note*: for support questions, please use one of these channels: [stackoverflow](http://stackoverflow.com/questions/tagged/socket.io) or [slack](https://socketio.slack.com)
**Note**: for support questions, please use one of these channels: [stackoverflow](http://stackoverflow.com/questions/tagged/socket.io) or [slack](https://socketio.slack.com)

For bug reports and feature requests for the **Swift client**, please open an issue [there](https://github.com/socketio/socket.io-client-swift).

For bug reports and feature requests for the **Java client**, please open an issue [there](https://github.com/socketio/socket.io-client-java).

### You want to:

@@ -8,12 +12,15 @@

### Current behaviour

*What is actually happening?*

### Steps to reproduce (if the current behaviour is a bug)

**Note**: the best way (and by that we mean **the only way**) to get a quick answer is to provide a failing test case by forking the following [fiddle](https://github.com/socketio/socket.io-fiddle).

### Expected behaviour

*What is expected?*

### Setup
- OS:
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,4 +10,5 @@ benchmarks/*.png
node_modules
coverage
.idea
dist
.nyc_output
dist/
30 changes: 6 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
sudo: false
before_install:
- npm install -g npm@'>=1.4.3'
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"
- "node"

git:
depth: 1

matrix:
include:
- node_js: '0.10'
env: TEST_VERSION=compat
- node_js: '0.12'
env: TEST_VERSION=compat
- node_js: '4'
env: TEST_VERSION=compat
#matrix:
#fast_finish: true
#allow_failures:
#- node_js: "0.11"

- '10'
- '12'
- '14'
notifications:
irc: "irc.freenode.org#socket.io"
git:
depth: 1
262 changes: 262 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# [3.0.0](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0) (2020-11-05)

### Bug Fixes

* close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))

### Features

* emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
* serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))
* add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
* make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
* remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))
* move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))
* add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
* do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
* remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
* remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
* remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
* remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
* throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))

### BREAKING CHANGES

* the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))

* Socket#join() and Socket#leave() do not accept a callback argument anymore.

Before:

```js
socket.join("room1", () => {
io.to("room1").emit("hello");
});
```

After:

```js
socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters
```

* the "connected" map is renamed to "sockets"
* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.
* the 'origins' option is removed

Before:

```js
new Server(3000, {
origins: ["https://example.com"]
});
```

The 'origins' option was used in the allowRequest method, in order to
determine whether the request should pass or not. And the Engine.IO
server would implicitly add the necessary Access-Control-Allow-xxx
headers.

After:

```js
new Server(3000, {
cors: {
origin: "https://example.com",
methods: ["GET", "POST"],
allowedHeaders: ["content-type"]
}
});
```

The already existing 'allowRequest' option can be used for validation:

```js
new Server(3000, {
allowRequest: (req, callback) => {
callback(null, req.headers.referer.startsWith("https://example.com"));
}
});
```

* Socket#rooms is now a Set instead of an object

* Namespace#connected is now a Map instead of an object

* there is no more implicit connection to the default namespace:

```js
// client-side
const socket = io("/admin");

// server-side
io.on("connect", socket => {
// not triggered anymore
})

io.use((socket, next) => {
// not triggered anymore
});

io.of("/admin").use((socket, next) => {
// triggered
});
```

* the Server#set() method was removed

This method was kept for backward-compatibility with pre-1.0 versions.


# [3.0.0-rc4](https://github.com/socketio/socket.io/compare/3.0.0-rc3...3.0.0-rc4) (2020-10-30)


### Features

* emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
* serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))



# [3.0.0-rc3](https://github.com/socketio/socket.io/compare/3.0.0-rc2...3.0.0-rc3) (2020-10-26)


### Features

* add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
* make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
* remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))


### BREAKING CHANGES

* the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))

* Socket#join() and Socket#leave() do not accept a callback argument anymore.

Before:

```js
socket.join("room1", () => {
io.to("room1").emit("hello");
});
```

After:

```js
socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters
```



# [3.0.0-rc2](https://github.com/socketio/socket.io/compare/3.0.0-rc1...3.0.0-rc2) (2020-10-15)


### Bug Fixes

* close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))


### Code Refactoring

* remove duplicate _sockets map ([8a5db7f](https://github.com/socketio/socket.io/commit/8a5db7fa36a075da75cde43cd4fb6382b7659953))


### Features

* move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))


### BREAKING CHANGES

* the "connected" map is renamed to "sockets"
* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.



# [3.0.0-rc1](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0-rc1) (2020-10-13)


### Features

* add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
* do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
* remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
* remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
* remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
* remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
* throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))


### BREAKING CHANGES

* the 'origins' option is removed

Before:

```js
new Server(3000, {
origins: ["https://example.com"]
});
```

The 'origins' option was used in the allowRequest method, in order to
determine whether the request should pass or not. And the Engine.IO
server would implicitly add the necessary Access-Control-Allow-xxx
headers.

After:

```js
new Server(3000, {
cors: {
origin: "https://example.com",
methods: ["GET", "POST"],
allowedHeaders: ["content-type"]
}
});
```

The already existing 'allowRequest' option can be used for validation:

```js
new Server(3000, {
allowRequest: (req, callback) => {
callback(null, req.headers.referer.startsWith("https://example.com"));
}
});
```

* Socket#rooms is now a Set instead of an object

* Namespace#connected is now a Map instead of an object

* there is no more implicit connection to the default namespace:

```js
// client-side
const socket = io("/admin");

// server-side
io.on("connect", socket => {
// not triggered anymore
})

io.use((socket, next) => {
// not triggered anymore
});

io.of("/admin").use((socket, next) => {
// triggered
});
```

* the Server#set() method was removed

This method was kept for backward-compatibility with pre-1.0 versions.

Loading