{"id":15538637,"url":"https://github.com/hden/socketio-wildcard","last_synced_at":"2025-05-15T04:08:21.415Z","repository":{"id":524349,"uuid":"20330412","full_name":"hden/socketio-wildcard","owner":"hden","description":"socket.io v2.x with a wildcard event","archived":false,"fork":false,"pushed_at":"2025-05-02T00:33:38.000Z","size":972,"stargazers_count":200,"open_issues_count":4,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-15T04:08:15.751Z","etag":null,"topics":["socket-io","socketio","socketio-wildcard"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-05-30T13:44:37.000Z","updated_at":"2025-05-11T13:40:17.000Z","dependencies_parsed_at":"2024-02-09T01:30:39.286Z","dependency_job_id":"85a1d746-8bb5-47a7-9839-1ceb4563b7d2","html_url":"https://github.com/hden/socketio-wildcard","commit_stats":{"total_commits":226,"total_committers":8,"mean_commits":28.25,"dds":0.3849557522123894,"last_synced_commit":"6e94077e1e8f6460fa24ebd7f7349bece77a44b8"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hden%2Fsocketio-wildcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hden%2Fsocketio-wildcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hden%2Fsocketio-wildcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hden%2Fsocketio-wildcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hden","download_url":"https://codeload.github.com/hden/socketio-wildcard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270656,"owners_count":22042860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["socket-io","socketio","socketio-wildcard"],"created_at":"2024-10-02T12:05:16.319Z","updated_at":"2025-05-15T04:08:16.404Z","avatar_url":"https://github.com/hden.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"socketio-wildcard\n=================\n\n[![Build Status](https://img.shields.io/travis/hden/socketio-wildcard.svg)](https://travis-ci.org/hden/socketio-wildcard)\n[![Dependencies](https://img.shields.io/david/hden/socketio-wildcard.svg)](https://david-dm.org/hden/socketio-wildcard)\n[![devDependencies](https://img.shields.io/david/dev/hden/socketio-wildcard.svg)](https://david-dm.org/hden/socketio-wildcard#info=devDependencies)\n[![npm](https://img.shields.io/npm/dm/socketio-wildcard.svg)](https://www.npmjs.com/package/socketio-wildcard)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![codecov](https://codecov.io/gh/hden/socketio-wildcard/branch/master/graph/badge.svg)](https://codecov.io/gh/hden/socketio-wildcard)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhden%2Fsocketio-wildcard.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhden%2Fsocketio-wildcard?ref=badge_shield)\n\n[![npm](https://nodei.co/npm-dl/socketio-wildcard.png?height=3)](https://nodei.co/npm/socketio-wildcard/)\n\nSocket.io with a wildcard event.\n\nWorks with Socket.io `v1.x` - `v2.x`.\n\nTested with node.js `v8.x` - `v12.x`.\n\nSunsetting\n----------\nAs of Socket.io v2.0.4 ([commit](https://github.com/socketio/socket.io/commit/5a123beea597c9fda7b722f18343fdc2c2755e79#diff-9b2f90c89d460ee80ced18e01748824e)), you can use a socket middleware to catch every incoming Packet, which satisfies most of socketio-wildcard's use cases.\n\n```js\nio.on('connection', (socket) =\u003e {\n  socket.use((packet, next) =\u003e {\n    // Handler\n    next();\n  });\n});\n```\n\nInstallation\n------------\n\n    npm install --save socketio-wildcard\n\n\nUsage\n-----\n\n### Server\n\n```js\nvar io         = require('socket.io')();\nvar middleware = require('socketio-wildcard')();\n\nio.use(middleware);\n\nio.on('connection', function(socket) {\n  socket.on('*', function(packet){\n    // client.emit('foo', 'bar', 'baz')\n    packet.data === ['foo', 'bar', 'baz']\n  });\n});\n\nio.listen(8000);\n```\n\n### Server (with a namespace)\n\n```diff\nvar io         = require('socket.io')();\n+var nsp        = io.of('/namespace');\nvar middleware = require('socketio-wildcard')();\n\n-io.use(middleware);\n+nsp.use(middleware);\n\n-io.on('connection', function(socket) {\n+nsp.on('connection', function(socket) {\n  socket.on('*', function(packet){\n    // client.emit('foo', 'bar', 'baz')\n    packet.data === ['foo', 'bar', 'baz']\n  });\n});\n\nio.listen(8000);\n```\n\n### Client\n\n```js\nvar io = require('socket.io-client');\nvar socket = io('http://localhost');\n// piggyback using the event-emitter bundled with socket.io client\nvar patch = require('socketio-wildcard')(io.Manager);\npatch(socket);\n\nsocket.on('*', function(){ /* … */ })\n```\n\nChangelog\n---------\n\n### [2.0.0] - 2016-05-23\n- no breaking change\n- update test dependencies for socket.io v2\n\n### [0.3.0] - 2015-12-21\n- allow custom event emitter\n- support socket.io client\n\n### [0.2.0] - 2015-11-29\n- wildcard listener for all events get called first ([@Michael77](https://github.com/Michael77))\n- removed coffee-script dependency\n\nLicence\n-------\nMIT\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhden%2Fsocketio-wildcard.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhden%2Fsocketio-wildcard?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhden%2Fsocketio-wildcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhden%2Fsocketio-wildcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhden%2Fsocketio-wildcard/lists"}