{"id":13614752,"url":"https://github.com/rikulo/socket.io-client-dart","last_synced_at":"2026-01-17T20:46:30.859Z","repository":{"id":37734425,"uuid":"90950487","full_name":"rikulo/socket.io-client-dart","owner":"rikulo","description":"socket.io-client-dart: Dartlang port of socket.io-client https://github.com/socketio/socket.io-client","archived":false,"fork":false,"pushed_at":"2026-01-16T05:38:42.000Z","size":253,"stargazers_count":705,"open_issues_count":139,"forks_count":197,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-01-16T21:22:26.189Z","etag":null,"topics":["dart","dartlang","flutter","quire","socket-io","socket-io-client","websocket"],"latest_commit_sha":null,"homepage":"https://quire.io","language":"Dart","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/rikulo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"contributing.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-11T07:28:46.000Z","updated_at":"2026-01-16T05:36:48.000Z","dependencies_parsed_at":"2024-01-17T00:18:25.481Z","dependency_job_id":"cb902e42-9993-481d-96f2-4d17d1fabf8b","html_url":"https://github.com/rikulo/socket.io-client-dart","commit_stats":{"total_commits":110,"total_committers":19,"mean_commits":"5.7894736842105265","dds":"0.19090909090909092","last_synced_commit":"b5af30004fe55feb0993a0449de3ac50671c67fa"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/rikulo/socket.io-client-dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikulo%2Fsocket.io-client-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikulo%2Fsocket.io-client-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikulo%2Fsocket.io-client-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikulo%2Fsocket.io-client-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rikulo","download_url":"https://codeload.github.com/rikulo/socket.io-client-dart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikulo%2Fsocket.io-client-dart/sbom","scorecard":{"id":776519,"data":{"date":"2025-08-11","repo":{"name":"github.com/rikulo/socket.io-client-dart","commit":"df9c7a5c423206bc9c520ddf1bdd8051cd65ad2d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":2,"reason":"Found 6/30 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T03:46:26.393Z","repository_id":37734425,"created_at":"2025-08-23T03:46:26.393Z","updated_at":"2025-08-23T03:46:26.393Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28518039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dart","dartlang","flutter","quire","socket-io","socket-io-client","websocket"],"created_at":"2024-08-01T20:01:05.285Z","updated_at":"2026-01-17T20:46:30.830Z","avatar_url":"https://github.com/rikulo.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"# socket.io-client-dart\n\nPort of awesome JavaScript Node.js library - [Socket.io-client v2._ ~ v4._](https://github.com/socketio/socket.io-client) - in Dart\n\n## Version info\n\n| socket.io-client-dart | Socket.io Server  |\n| --------------------- | ----------------- |\n| `v0.9.*` ~ `v1.*`     | `v2.*`            |\n| `v2.*`                | `v3.*` ~ `v4.6.*` |\n| `v3.*`                | `v4.7.* ~ v4.*`   |\n\n## Usage\n\n### Dart Server\n\n```dart\nimport 'package:socket_io/socket_io.dart';\n\nmain() {\n  // Dart server\n  var io = Server();\n  var nsp = io.of('/some');\n  nsp.on('connection', (client) {\n    print('connection /some');\n    client.on('msg', (data) {\n      print('data from /some =\u003e $data');\n      client.emit('fromServer', \"ok 2\");\n    });\n  });\n  io.on('connection', (client) {\n    print('connection default namespace');\n    client.on('msg', (data) {\n      print('data from default =\u003e $data');\n      client.emit('fromServer', \"ok\");\n    });\n  });\n  io.listen(3000);\n}\n```\n\n### Dart Client\n\n```dart\n\nimport 'package:socket_io_client/socket_io_client.dart' as IO;\n\nmain() {\n  // Dart client\n  IO.Socket socket = IO.io('http://localhost:3000');\n  socket.onConnect((_) {\n    print('connect');\n    socket.emit('msg', 'test');\n  });\n  socket.on('event', (data) =\u003e print(data));\n  socket.onDisconnect((_) =\u003e print('disconnect'));\n  socket.on('fromServer', (_) =\u003e print(_));\n}\n```\n\n### Connect manually\n\nTo connect the socket manually, set the option `autoConnect: false` and call `.connect()`.\n\nFor example,\n\n\u003cpre\u003e\nSocket socket = io('http://localhost:3000',\n    OptionBuilder()\n      .setTransports(['websocket']) // for Flutter or Dart VM\n      .\u003cb\u003edisableAutoConnect()\u003c/b\u003e  // disable auto-connection\n      .setExtraHeaders({'foo': 'bar'}) // optional\n      .build()\n  );\n\u003cb\u003esocket.connect();\u003c/b\u003e\n\u003c/pre\u003e\n\nNote that `.connect()` should not be called if `autoConnect: true`\n(by default, it's enabled to true), as this will cause all event handlers to get registered/fired twice. See [Issue #33](https://github.com/rikulo/socket.io-client-dart/issues/33).\n\n### Update the extra headers\n\n```dart\nSocket socket = ... // Create socket.\nsocket.io.options['extraHeaders'] = {'foo': 'bar'}; // Update the extra headers.\nsocket.io..disconnect()..connect(); // Reconnect the socket manually.\n```\n\n### Emit with acknowledgement\n\n```dart\nSocket socket = ... // Create socket.\nsocket.onConnect((_) {\n    print('connect');\n    socket.emitWithAck('msg', 'init', ack: (data) {\n        print('ack $data') ;\n        if (data != null) {\n          print('from server $data');\n        } else {\n          print(\"Null\") ;\n        }\n    });\n});\n```\n\n### Socket connection events\n\nThese events can be listened on.\n\n```dart\nconst List EVENTS = [\n  'connect',\n  'connect_error',\n  'disconnect',\n  'error',\n  'reconnect',\n  'reconnect_attempt',\n  'reconnect_failed',\n  'reconnect_error',\n  'ping',\n  'pong'\n];\n\n// Replace 'onConnect' with any of the above events.\nsocket.onConnect((_) {\n    print('connect');\n});\n```\n\n### Acknowledge with the socket server that an event has been received\n\n```dart\nsocket.on('eventName', (data) {\n    final dataList = data as List;\n    final ack = dataList.last as Function;\n    ack(null);\n});\n```\n\n## Usage (Flutter)\n\nIn Flutter env. not (Flutter Web env.) it only works with `dart:io` websocket,\nnot with `dart:html` websocket or Ajax (XHR), so in this case\nyou have to add `setTransports(['websocket'])` when creates the socket instance.\n\nFor example,\n\n```dart\nIO.Socket socket = IO.io('http://localhost:3000',\n  OptionBuilder()\n      .setTransports(['websocket']) // for Flutter or Dart VM\n      .setExtraHeaders({'foo': 'bar'}) // optional\n      .build());\n```\n\n## Usage with stream and StreamBuilder in Flutter\n\n```dart\nimport 'dart:async';\n\n\n// STEP1:  Stream setup\nclass StreamSocket{\n  final _socketResponse= StreamController\u003cString\u003e();\n\n  void Function(String) get addResponse =\u003e _socketResponse.sink.add;\n\n  Stream\u003cString\u003e get getResponse =\u003e _socketResponse.stream;\n\n  void dispose(){\n    _socketResponse.close();\n  }\n}\n\nStreamSocket streamSocket =StreamSocket();\n\n//STEP2: Add this function in main function in main.dart file and add incoming data to the stream\nvoid connectAndListen(){\n  IO.Socket socket = IO.io('http://localhost:3000',\n      OptionBuilder()\n       .setTransports(['websocket']).build());\n\n    socket.onConnect((_) {\n     print('connect');\n     socket.emit('msg', 'test');\n    });\n\n    //When an event received from server, data is added to the stream\n    socket.on('event', (data) =\u003e streamSocket.addResponse);\n    socket.onDisconnect((_) =\u003e print('disconnect'));\n\n}\n\n//Step3: Build widgets with StreamBuilder\n\nclass BuildWithSocketStream extends StatelessWidget {\n  const BuildWithSocketStream({Key key}) : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    return Container(\n      child: StreamBuilder(\n        stream: streamSocket.getResponse ,\n        builder: (BuildContext context, AsyncSnapshot\u003cString\u003e snapshot){\n          return Container(\n            child: snapshot.data,\n          );\n        },\n      ),\n    );\n  }\n}\n\n```\n\n## Important Notice: Handling Socket Cache and subsequent lookups\n\nThere is a design decision in the baseline IO lookup command related to the caching of socket instances.\n\n### Lookup protocol\n\n**We reuse the existing instance based on same scheme/port/host.**\n\nIt is important to make clear that both `dispose()` and `destroy()` do NOT remove a host from the cache of known connections. This can cause attempted\nsubsequent connections to ignore certain parts of your configuration if not handled correctly. You must handle this by using the options\navailable in the OptionBuilder _during the first creation_ of the instance.\n\n### Examples\n\nIn the following example, there is a userId and username set as extra headers for this connection.\nIf you were to try and create the same connection with updated values, if the host is the same, the extra headers will not be updated and the old\nconnection would be returned.\n\n```dart\n_socket = io.io(\n        host,\n        io.OptionBuilder()\n            .setTransports(['websocket'])\n            .setExtraHeaders({'id': userId, 'name': username})\n            .disableAutoConnect()\n            .enableReconnection()\n            .build());\n```\n\nIn order to prevent this, depending on your application's needs, you can either use `enableForceNew()` or `disableMultiplex()` to the\noption builder. These options would modify all connections using the same host, so be aware and plan accordingly.\n\nAn additional option, if it fits your use case, would be to follow the usage mentioned above in [Update the extra headers](#update-the-extra-headers).\nBy updating the extra headers outside of the building of the options, you can guarantee that your connections will have the values you are expecting.\n\n## Troubleshooting\n\n### Cannot connect \"https\" server or self-signed certificate server\n\n- Refer to \u003chttps://github.com/dart-lang/sdk/issues/34284\u003e issue.\n  The workaround is to use the following code provided by [@lehno](https://github.com/lehno) on [#84](https://github.com/rikulo/socket.io-client-dart/issues/84)\n\n```dart\nclass MyHttpOverrides extends HttpOverrides {\n  @override\n  HttpClient createHttpClient(SecurityContext? context) {\n    return super.createHttpClient(context)\n      ..badCertificateCallback =\n          (X509Certificate cert, String host, int port) =\u003e true;\n  }\n}\n\nvoid main() {\n  HttpOverrides.global = MyHttpOverrides();\n  runApp(MyApp());\n}\n```\n\n### Memory leak issues in iOS when closing socket\n\n- Refer to \u003chttps://github.com/rikulo/socket.io-client-dart/issues/108\u003e issue.\n  Please use `socket.dispose()` instead of `socket.close()` or `socket.disconnect()` to solve the memory leak issue on iOS.\n\n### Connect_error on MacOS with SocketException: Connection failed\n\n- Refer to \u003chttps://github.com/flutter/flutter/issues/47606#issuecomment-568522318\u003e issue.\n\nBy adding the following key into the to file `*.entitlements` under directory `macos/Runner/`\n\n```xml\n\u003ckey\u003ecom.apple.security.network.client\u003c/key\u003e\n\u003ctrue/\u003e\n```\n\nFor more details, please take a look at \u003chttps://flutter.dev/desktop#setting-up-entitlements\u003e\n\n### Can't connect socket server on Flutter with Insecure HTTP connection\n\n- Refer to \u003chttps://flutter.dev/docs/release/breaking-changes/network-policy-ios-android\u003e\n\nThe HTTP connections are disabled by default on iOS and Android, so here is a workaround to this issue,\nwhich mentioned on [stack overflow](https://stackoverflow.com/a/65730723)\n\n## Notes to Contributors\n\n### Fork socket.io-client-dart\n\nIf you'd like to contribute back to the core, you can [fork this repository](https://help.github.com/articles/fork-a-repo) and send us a pull request, when it is ready.\n\nIf you are new to Git or GitHub, please read [this guide](https://help.github.com/) first.\n\nContribution of all kinds is welcome. Please read [Contributing.md](https://github.com/rikulo/socket.io-client-dart/blob/master/contributing.md) in this repository.\n\n## Who Uses\n\n- [Quire](https://quire.io) - a simple, collaborative, multi-level task management tool.\n- [KEIKAI](https://keikai.io/) - a web spreadsheet for Big Data.\n\n## Socket.io Dart Server\n\n- [socket.io-dart](https://github.com/rikulo/socket.io-dart)\n\n## Contributors\n\n\u003ca href=\"https://github.com/rikulo/socket.io-client-dart/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=rikulo/socket.io-client-dart\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikulo%2Fsocket.io-client-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frikulo%2Fsocket.io-client-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikulo%2Fsocket.io-client-dart/lists"}