{"id":17359092,"url":"https://github.com/zishang520/socket.io-go-redis","last_synced_at":"2025-07-07T08:33:20.213Z","repository":{"id":184422673,"uuid":"671854995","full_name":"zishang520/socket.io-go-redis","owner":"zishang520","description":"You can use the redis function happily","archived":false,"fork":false,"pushed_at":"2025-04-08T03:56:30.000Z","size":94,"stargazers_count":5,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T04:28:50.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/zishang520.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-28T09:44:25.000Z","updated_at":"2025-04-08T03:56:17.000Z","dependencies_parsed_at":"2023-12-07T10:29:10.864Z","dependency_job_id":"1bd3662d-058f-48fd-a080-7a7c63f8253d","html_url":"https://github.com/zishang520/socket.io-go-redis","commit_stats":null,"previous_names":["zishang520/socket.io-go-redis-adapter","zishang520/socket.io-go-redis"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fsocket.io-go-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fsocket.io-go-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fsocket.io-go-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fsocket.io-go-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zishang520","download_url":"https://codeload.github.com/zishang520/socket.io-go-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248984275,"owners_count":21193717,"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":[],"created_at":"2024-10-15T19:08:02.984Z","updated_at":"2025-04-15T00:31:30.557Z","avatar_url":"https://github.com/zishang520.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# socket.io-go-redis\n\n[![Go](https://github.com/zishang520/socket.io-go-redis/actions/workflows/go.yml/badge.svg)](https://github.com/zishang520/socket.io-go-redis/actions/workflows/go.yml)\n[![GoDoc](https://pkg.go.dev/badge/github.com/zishang520/socket.io-go-redis?utm_source=godoc)](https://pkg.go.dev/github.com/zishang520/socket.io-go-redis)\n\n## How to use\n\n```golang\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"os\"\n    \"os/signal\"\n    \"syscall\"\n\n    \"github.com/redis/go-redis/v9\"\n    s \"github.com/zishang520/engine.io/v2/types\"\n    \"github.com/zishang520/socket.io-go-redis/adapter\"\n    \"github.com/zishang520/socket.io-go-redis/types\"\n    \"github.com/zishang520/socket.io/v2/socket\"\n    // \"github.com/zishang520/socket.io-go-redis/emitter\"\n)\n\nfunc main() {\n\n    redisClient := types.NewRedisClient(context.TODO(), redis.NewClient(\u0026redis.Options{\n        Addr:     \"127.0.0.1:6379\",\n        Username: \"\",\n        Password: \"\",\n        DB:       0,\n    }))\n\n    redisClient.On(\"error\", func(a ...any) {\n        fmt.Println(a)\n    })\n\n    config := socket.DefaultServerOptions()\n    config.SetAdapter(\u0026adapter.RedisAdapterBuilder{\n        Redis: redisClient,\n        Opts:  \u0026adapter.RedisAdapterOptions{},\n    })\n    httpServer := s.CreateServer(nil)\n    io := socket.NewServer(httpServer, config)\n    io.On(\"connection\", func(clients ...any) {\n        client := clients[0].(*socket.Socket)\n        client.On(\"event\", func(datas ...any) {\n        })\n        client.On(\"disconnect\", func(...any) {\n        })\n    })\n    httpServer.Listen(\"127.0.0.1:9000\", nil)\n\n    // emitter.NewEmitter(redisClient, nil, \"/web\") // more ....\n\n    exit := make(chan struct{})\n    SignalC := make(chan os.Signal)\n\n    signal.Notify(SignalC, os.Interrupt, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)\n    go func() {\n        for s := range SignalC {\n            switch s {\n            case os.Interrupt, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT:\n                close(exit)\n                return\n            }\n        }\n    }()\n\n    \u003c-exit\n    httpServer.Close(nil)\n    os.Exit(0)\n}\n```\n\n## Tests\n\nStandalone tests can be run with `make test` which will run the golang tests.\n\nYou can run the tests locally using the following command:\n\n```\nmake test\n```\n\n## Support\n\n[issues](https://github.com/zishang520/socket.io-go-redis/issues)\n\n## Development\n\nTo contribute patches, run tests or benchmarks, make sure to clone the\nrepository:\n\n```bash\ngit clone git://github.com/zishang520/socket.io-go-redis.git\n```\n\nThen:\n\n```bash\ncd socket.io-go-redis\nmake test\n```\n\nSee the `Tests` section above for how to run tests before submitting any patches.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzishang520%2Fsocket.io-go-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzishang520%2Fsocket.io-go-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzishang520%2Fsocket.io-go-redis/lists"}