{"id":19361811,"url":"https://github.com/missthee/springboot-socketio-simple-demo","last_synced_at":"2025-11-18T09:03:08.671Z","repository":{"id":111961848,"uuid":"176634796","full_name":"MissThee/springboot-socketio-simple-demo","owner":"MissThee","description":"[Empty Project]springboot,-socketio简单聊天实例，包含简易页面与服务端","archived":false,"fork":false,"pushed_at":"2019-05-23T03:09:43.000Z","size":53,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T12:42:10.072Z","etag":null,"topics":["chat","socket","socketio","springboot","websocket"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MissThee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-03-20T02:17:22.000Z","updated_at":"2025-01-13T01:33:07.000Z","dependencies_parsed_at":"2023-07-08T23:15:44.143Z","dependency_job_id":null,"html_url":"https://github.com/MissThee/springboot-socketio-simple-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MissThee/springboot-socketio-simple-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MissThee%2Fspringboot-socketio-simple-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MissThee%2Fspringboot-socketio-simple-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MissThee%2Fspringboot-socketio-simple-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MissThee%2Fspringboot-socketio-simple-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MissThee","download_url":"https://codeload.github.com/MissThee/springboot-socketio-simple-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MissThee%2Fspringboot-socketio-simple-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285035891,"owners_count":27103933,"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","status":"online","status_checked_at":"2025-11-18T02:00:05.759Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chat","socket","socketio","springboot","websocket"],"created_at":"2024-11-10T07:25:29.909Z","updated_at":"2025-11-18T09:03:08.632Z","avatar_url":"https://github.com/MissThee.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# springboot-socketio简易实时聊天\n### 结构\n```$xslt\nsrc\n └─main\n     └─java\n        └─com\n            └─github\n                └─missthee\n                    │  WebApplication.java\n                    │\n                    ├─db\n                    │  ├─data\n                    │  │      FakeDB.java    //模拟用户数据\n                    │  │\n                    │  └─model\n                    │          User.java    //用户类\n                    │\n                    ├─html\n                    │      socketio-test.html    //测试网页\n                    │\n                    └─socketio\n                        │  MessageEventHandler.java    //自定义监听事件\n                        │\n                        ├─config\n                        │      MyCommandLineRunner.java    //socketio启动配置（也可直接在spring启动类中直接启动）\n                        │      SocketIOServerConfig.java    //socketio服务配置\n                        │\n                        └─model\n                                AckModel.java    //ack确认信息使用的类\n                                MessageModel.java    //收发信息使用的类\n      \n```\n### 聊天功能简介\n+ socket.io会为每个`链接`生成uuid，项目中每个`用户`有自身的id，采用id与List\u003cuuid\u003e方式存储`用户`与`链接`的关系，维护`在线用户表`\n+ 每个`用户`账号可在多个客户端同时登陆，同时保持多个`链接`，同时接收发消息\n+ 当`用户`至少有一个`链接`时，为在线状态；当`用户`没有任何链接时，`用户`从`在线用户表`中移除，为离线状态(目前用户列表由广播发送，于每个用户创建/断开连接时触发)\n### 测试方式：  \n1. 克隆本项目到本地\n2. application.properties中server.port修改为任意空闲端口号（此端口不是socket使用的端口，而是为了让springboot无端口冲突，启动起来），或自行配置springboot停用内置tomcat\n3. 运行服务端\n4. 使用chrome浏览器打开项目目录html/socketio-test.html文件。  \n  输入正确的后台地址，端口号。输入用户id （0到9任意）。连接，测试。\n注：本项目，单个用户可在多个客户端登录，同时接收消息\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissthee%2Fspringboot-socketio-simple-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmissthee%2Fspringboot-socketio-simple-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissthee%2Fspringboot-socketio-simple-demo/lists"}