forked from arne/TanksJS-Server
Changes to conform socket.io version 3
This commit is contained in:
parent
da4e418707
commit
9b4424c830
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
dist
|
||||||
release
|
release
|
||||||
|
.vscode
|
275
package-lock.json
generated
275
package-lock.json
generated
@ -78,11 +78,6 @@
|
|||||||
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"after": {
|
|
||||||
"version": "0.8.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz",
|
|
||||||
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
|
|
||||||
},
|
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.12.2",
|
"version": "6.12.2",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
|
||||||
@ -185,62 +180,29 @@
|
|||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||||
},
|
},
|
||||||
"arraybuffer.slice": {
|
|
||||||
"version": "0.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz",
|
|
||||||
"integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog=="
|
|
||||||
},
|
|
||||||
"astral-regex": {
|
"astral-regex": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
|
||||||
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
|
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"async-limiter": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
|
||||||
},
|
|
||||||
"backo2": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc="
|
|
||||||
},
|
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"base64-arraybuffer": {
|
|
||||||
"version": "0.1.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
|
|
||||||
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
|
|
||||||
},
|
|
||||||
"base64id": {
|
"base64id": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
|
||||||
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog=="
|
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog=="
|
||||||
},
|
},
|
||||||
"better-assert": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
|
|
||||||
"requires": {
|
|
||||||
"callsite": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"binary-extensions": {
|
"binary-extensions": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
|
||||||
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
|
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"blob": {
|
|
||||||
"version": "0.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
|
|
||||||
"integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig=="
|
|
||||||
},
|
|
||||||
"body-parser": {
|
"body-parser": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||||
@ -397,11 +359,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"callsite": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA="
|
|
||||||
},
|
|
||||||
"callsites": {
|
"callsites": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||||
@ -503,20 +460,10 @@
|
|||||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
||||||
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
||||||
},
|
},
|
||||||
"component-bind": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E="
|
|
||||||
},
|
|
||||||
"component-emitter": {
|
"component-emitter": {
|
||||||
"version": "1.2.1",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
|
||||||
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
|
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
|
||||||
},
|
|
||||||
"component-inherit": {
|
|
||||||
"version": "0.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz",
|
|
||||||
"integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM="
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
@ -561,6 +508,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||||
},
|
},
|
||||||
|
"cors": {
|
||||||
|
"version": "2.8.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||||
|
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||||
|
"requires": {
|
||||||
|
"object-assign": "^4",
|
||||||
|
"vary": "^1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "6.0.5",
|
"version": "6.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||||
@ -683,64 +639,30 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"engine.io": {
|
"engine.io": {
|
||||||
"version": "3.4.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-4.0.1.tgz",
|
||||||
"integrity": "sha512-8MfIfF1/IIfxuc2gv5K+XlFZczw/BpTvqBdl0E2fBLkYQp4miv4LuDTVtYt4yMyaIFLEr4vtaSgV4mjvll8Crw==",
|
"integrity": "sha512-6EaSBxasBUwxRdf6B68SEYpD3tcrG80J4YTzHl/D+9Q+vM0AMHZabfYcc2WdnvEaQxZjX/UZsa+UdGoM0qQQkQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"accepts": "~1.3.4",
|
"accepts": "~1.3.4",
|
||||||
"base64id": "2.0.0",
|
"base64id": "2.0.0",
|
||||||
"cookie": "0.3.1",
|
"cookie": "~0.4.1",
|
||||||
|
"cors": "~2.8.5",
|
||||||
"debug": "~4.1.0",
|
"debug": "~4.1.0",
|
||||||
"engine.io-parser": "~2.2.0",
|
"engine.io-parser": "~4.0.0",
|
||||||
"ws": "^7.1.2"
|
"ws": "^7.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookie": {
|
"cookie": {
|
||||||
"version": "0.3.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
|
||||||
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
|
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"engine.io-client": {
|
|
||||||
"version": "3.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.1.tgz",
|
|
||||||
"integrity": "sha512-RJNmA+A9Js+8Aoq815xpGAsgWH1VoSYM//2VgIiu9lNOaHFfLpTjH4tOzktBpjIs5lvOfiNY1dwf+NuU6D38Mw==",
|
|
||||||
"requires": {
|
|
||||||
"component-emitter": "1.2.1",
|
|
||||||
"component-inherit": "0.0.3",
|
|
||||||
"debug": "~4.1.0",
|
|
||||||
"engine.io-parser": "~2.2.0",
|
|
||||||
"has-cors": "1.1.0",
|
|
||||||
"indexof": "0.0.1",
|
|
||||||
"parseqs": "0.0.5",
|
|
||||||
"parseuri": "0.0.5",
|
|
||||||
"ws": "~6.1.0",
|
|
||||||
"xmlhttprequest-ssl": "~1.5.4",
|
|
||||||
"yeast": "0.1.2"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ws": {
|
|
||||||
"version": "6.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz",
|
|
||||||
"integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==",
|
|
||||||
"requires": {
|
|
||||||
"async-limiter": "~1.0.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"engine.io-parser": {
|
"engine.io-parser": {
|
||||||
"version": "2.2.0",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-4.0.1.tgz",
|
||||||
"integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==",
|
"integrity": "sha512-v5aZK1hlckcJDGmHz3W8xvI3NUHYc9t8QtTbqdR5OaH3S9iJZilPubauOm+vLWOMMWzpE3hiq92l9lTAHamRCg=="
|
||||||
"requires": {
|
|
||||||
"after": "0.8.2",
|
|
||||||
"arraybuffer.slice": "~0.0.7",
|
|
||||||
"base64-arraybuffer": "0.1.5",
|
|
||||||
"blob": "0.0.5",
|
|
||||||
"has-binary2": "~1.0.2"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"escape-goat": {
|
"escape-goat": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
@ -1147,19 +1069,6 @@
|
|||||||
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
|
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"has-binary2": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==",
|
|
||||||
"requires": {
|
|
||||||
"isarray": "2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"has-cors": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
|
|
||||||
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
|
|
||||||
},
|
|
||||||
"has-flag": {
|
"has-flag": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||||
@ -1239,11 +1148,6 @@
|
|||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"indexof": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
|
|
||||||
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
|
|
||||||
},
|
|
||||||
"inflight": {
|
"inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
@ -1444,11 +1348,6 @@
|
|||||||
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"isarray": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz",
|
|
||||||
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
|
|
||||||
},
|
|
||||||
"isexe": {
|
"isexe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
@ -1691,10 +1590,10 @@
|
|||||||
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==",
|
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"object-component": {
|
"object-assign": {
|
||||||
"version": "0.0.3",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE="
|
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||||
},
|
},
|
||||||
"on-finished": {
|
"on-finished": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
@ -1769,22 +1668,6 @@
|
|||||||
"callsites": "^3.0.0"
|
"callsites": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parseqs": {
|
|
||||||
"version": "0.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz",
|
|
||||||
"integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=",
|
|
||||||
"requires": {
|
|
||||||
"better-assert": "~1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parseuri": {
|
|
||||||
"version": "0.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz",
|
|
||||||
"integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=",
|
|
||||||
"requires": {
|
|
||||||
"better-assert": "~1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parseurl": {
|
"parseurl": {
|
||||||
"version": "1.3.3",
|
"version": "1.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||||
@ -2121,79 +2004,30 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"socket.io": {
|
"socket.io": {
|
||||||
"version": "2.3.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-3.0.0.tgz",
|
||||||
"integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==",
|
"integrity": "sha512-arLQtd+UoJ08NXBRBGUJDyQ9B+cc9WwD67hc5s1WQcs2DyAkYzI5HWg4U0CrFtK00kjyAWxBGhLwVbfOeMqz1A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"accepts": "~1.3.4",
|
||||||
|
"base64id": "~2.0.0",
|
||||||
"debug": "~4.1.0",
|
"debug": "~4.1.0",
|
||||||
"engine.io": "~3.4.0",
|
"engine.io": "~4.0.0",
|
||||||
"has-binary2": "~1.0.2",
|
"socket.io-adapter": "~2.0.3",
|
||||||
"socket.io-adapter": "~1.1.0",
|
"socket.io-parser": "~4.0.1"
|
||||||
"socket.io-client": "2.3.0",
|
|
||||||
"socket.io-parser": "~3.4.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"socket.io-adapter": {
|
"socket.io-adapter": {
|
||||||
"version": "1.1.2",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.0.3.tgz",
|
||||||
"integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g=="
|
"integrity": "sha512-2wo4EXgxOGSFueqvHAdnmi5JLZzWqMArjuP4nqC26AtLh5PoCPsaRbRdah2xhcwTAMooZfjYiNVNkkmmSMaxOQ=="
|
||||||
},
|
|
||||||
"socket.io-client": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==",
|
|
||||||
"requires": {
|
|
||||||
"backo2": "1.0.2",
|
|
||||||
"base64-arraybuffer": "0.1.5",
|
|
||||||
"component-bind": "1.0.0",
|
|
||||||
"component-emitter": "1.2.1",
|
|
||||||
"debug": "~4.1.0",
|
|
||||||
"engine.io-client": "~3.4.0",
|
|
||||||
"has-binary2": "~1.0.2",
|
|
||||||
"has-cors": "1.1.0",
|
|
||||||
"indexof": "0.0.1",
|
|
||||||
"object-component": "0.0.3",
|
|
||||||
"parseqs": "0.0.5",
|
|
||||||
"parseuri": "0.0.5",
|
|
||||||
"socket.io-parser": "~3.3.0",
|
|
||||||
"to-array": "0.1.4"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
|
||||||
},
|
},
|
||||||
"socket.io-parser": {
|
"socket.io-parser": {
|
||||||
"version": "3.3.0",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.1.tgz",
|
||||||
"integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==",
|
"integrity": "sha512-5JfNykYptCwU2lkOI0ieoePWm+6stEhkZ2UnLDjqnE1YEjUlXXLd1lpxPZ+g+h3rtaytwWkWrLQCaJULlGqjOg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"component-emitter": "1.2.1",
|
"component-emitter": "~1.3.0",
|
||||||
"debug": "~3.1.0",
|
"debug": "~4.1.0"
|
||||||
"isarray": "2.0.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"socket.io-parser": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-/G/VOI+3DBp0+DJKW4KesGnQkQPFmUCbA/oO2QGT6CWxU7hLGWqU3tyuzeSK/dqcyeHsQg1vTe9jiZI8GU9SCQ==",
|
|
||||||
"requires": {
|
|
||||||
"component-emitter": "1.2.1",
|
|
||||||
"debug": "~4.1.0",
|
|
||||||
"isarray": "2.0.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sprintf-js": {
|
"sprintf-js": {
|
||||||
@ -2325,11 +2159,6 @@
|
|||||||
"os-tmpdir": "~1.0.2"
|
"os-tmpdir": "~1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"to-array": {
|
|
||||||
"version": "0.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz",
|
|
||||||
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
|
|
||||||
},
|
|
||||||
"to-readable-stream": {
|
"to-readable-stream": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz",
|
||||||
@ -2597,25 +2426,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.2.3",
|
"version": "7.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz",
|
||||||
"integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ=="
|
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA=="
|
||||||
},
|
},
|
||||||
"xdg-basedir": {
|
"xdg-basedir": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
|
||||||
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
|
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
|
||||||
"xmlhttprequest-ssl": {
|
|
||||||
"version": "1.5.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz",
|
|
||||||
"integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4="
|
|
||||||
},
|
|
||||||
"yeast": {
|
|
||||||
"version": "0.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
|
||||||
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"socket.io": "^2.3.0"
|
"socket.io": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
|
22
src/index.js
22
src/index.js
@ -31,7 +31,6 @@ app.get("/", (req, res) => {
|
|||||||
io.on("connection", (socket) => {
|
io.on("connection", (socket) => {
|
||||||
// Handle disconnection
|
// Handle disconnection
|
||||||
socket.on("disconnect", () => {
|
socket.on("disconnect", () => {
|
||||||
|
|
||||||
if (players[socket.id]) {
|
if (players[socket.id]) {
|
||||||
const room = players[socket.id].room;
|
const room = players[socket.id].room;
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ io.on("connection", (socket) => {
|
|||||||
|
|
||||||
console.log(traffic.out + colours.disconnect(`User ${String(socket.id)} disconnected from room ${room}`));
|
console.log(traffic.out + colours.disconnect(`User ${String(socket.id)} disconnected from room ${room}`));
|
||||||
|
|
||||||
if (io.sockets.adapter.rooms[room] == undefined) {
|
if (io.sockets.adapter.rooms.get(room) == undefined) {
|
||||||
console.log(traffic.int + colours.room(`Room ${room} has been deleted due to a lack of players`));
|
console.log(traffic.int + colours.room(`Room ${room} has been deleted due to a lack of players`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,6 +53,9 @@ io.on("connection", (socket) => {
|
|||||||
delete players[socket.id];
|
delete players[socket.id];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(traffic.in + colours.request(`Socket ${String(socket.id)} is trying to connect`));
|
||||||
|
console.log(traffic.out + colours.data(`Requesting identification to client ${String(socket.id)}`));
|
||||||
|
|
||||||
// Request identification
|
// Request identification
|
||||||
socket.emit("identify");
|
socket.emit("identify");
|
||||||
|
|
||||||
@ -65,12 +67,12 @@ io.on("connection", (socket) => {
|
|||||||
var join = "";
|
var join = "";
|
||||||
|
|
||||||
// Check if there are any available rooms for the requested game and check if they aren't full
|
// Check if there are any available rooms for the requested game and check if they aren't full
|
||||||
for (const room in io.sockets.adapter.rooms) {
|
io.sockets.adapter.rooms.forEach((set, room) => {
|
||||||
if (/[0-9]_[0-9].*/i.test(room)) {
|
if (/[0-9]_[0-9].*/i.test(room)) {
|
||||||
var roomId = room.split("_");
|
var roomId = room.split("_");
|
||||||
if (roomId[0] == data.gameID) {
|
if (roomId[0] == data.gameID) {
|
||||||
if (roomId[1] == data.playersMax) {
|
if (roomId[1] == data.playersMax) {
|
||||||
if (Object.keys(io.sockets.adapter.rooms[room].sockets).length < data.playersMax) {
|
if (io.sockets.adapter.rooms.get(room).size < data.playersMax) {
|
||||||
join += room;
|
join += room;
|
||||||
} else {
|
} else {
|
||||||
console.log(traffic.int + colours.room(`Room ${room} is full, skipping.`));
|
console.log(traffic.int + colours.room(`Room ${room} is full, skipping.`));
|
||||||
@ -78,13 +80,13 @@ io.on("connection", (socket) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// If no available room is found, make one
|
// If no available room is found, make one
|
||||||
if (join == "") {
|
if (join == "") {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var regex = new RegExp(data.gameID + "_" + data.playersMax + "_[0-9].*");
|
var regex = new RegExp(data.gameID + "_" + data.playersMax + "_[0-9].*");
|
||||||
Object.keys(io.sockets.adapter.rooms).forEach(room => {
|
io.sockets.adapter.rooms.forEach((set, room) => {
|
||||||
if (regex.test(room)) {
|
if (regex.test(room)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -97,7 +99,7 @@ io.on("connection", (socket) => {
|
|||||||
socket.join(join);
|
socket.join(join);
|
||||||
|
|
||||||
// Start game if the max number of players is reached
|
// Start game if the max number of players is reached
|
||||||
if (Object.keys(io.sockets.adapter.rooms[join].sockets).length == data.playersMax) {
|
if (io.sockets.adapter.rooms.get(join).size == data.playersMax) {
|
||||||
console.log(traffic.int + colours.room(`Room ${join} has reached the maximum amount of players, starting game`));
|
console.log(traffic.int + colours.room(`Room ${join} has reached the maximum amount of players, starting game`));
|
||||||
io.in(join).emit("gameStart");
|
io.in(join).emit("gameStart");
|
||||||
}
|
}
|
||||||
@ -107,10 +109,12 @@ io.on("connection", (socket) => {
|
|||||||
room: join
|
room: join
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(players);
|
||||||
|
|
||||||
var playerUpdate = {};
|
var playerUpdate = {};
|
||||||
for (const id in io.sockets.adapter.rooms[join].sockets) {
|
io.sockets.adapter.rooms.get(join).forEach((id) => {
|
||||||
playerUpdate[id] = players[id];
|
playerUpdate[id] = players[id];
|
||||||
}
|
});
|
||||||
|
|
||||||
io.in(join).emit("roomUpdate", playerUpdate);
|
io.in(join).emit("roomUpdate", playerUpdate);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user