{"id":29189756,"url":"https://github.com/damoye/gotalk","last_synced_at":"2025-07-01T23:09:30.662Z","repository":{"id":57600761,"uuid":"85291928","full_name":"damoye/gotalk","owner":"damoye","description":"Simple Go network communication library.","archived":false,"fork":false,"pushed_at":"2017-03-21T07:32:29.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T13:39:56.353Z","etag":null,"topics":["go","network"],"latest_commit_sha":null,"homepage":null,"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/damoye.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}},"created_at":"2017-03-17T09:05:32.000Z","updated_at":"2017-03-17T09:44:46.000Z","dependencies_parsed_at":"2022-08-25T17:52:12.650Z","dependency_job_id":null,"html_url":"https://github.com/damoye/gotalk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/damoye/gotalk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoye%2Fgotalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoye%2Fgotalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoye%2Fgotalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoye%2Fgotalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damoye","download_url":"https://codeload.github.com/damoye/gotalk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoye%2Fgotalk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263047678,"owners_count":23405280,"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":["go","network"],"created_at":"2025-07-01T23:09:30.042Z","updated_at":"2025-07-01T23:09:30.631Z","avatar_url":"https://github.com/damoye.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gotalk\n[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/damoye/gotalk)\n[![Build Status](https://travis-ci.org/damoye/gotalk.svg?branch=master)](https://travis-ci.org/damoye/gotalk)\n[![Coverage Status](https://coveralls.io/repos/github/damoye/gotalk/badge.svg)](https://coveralls.io/github/damoye/gotalk)\n\nSimple Go network communication library.\n\nGotalk makes up for the missing message boundaries of TCP. It can be combined with serialization tools like JSON and Protocol Buffers. It makes network communication much easier. Its inspiration comes from the [Bulk Strings from RESP](https://redis.io/topics/protocol#resp-bulk-strings)\n\n## Protocol\nGotalk defines a protocol like this:\n\n```go\n(length_of_message)\\r\\n(message)\\r\\n\n```\n\nFor example:\n\nmessage       | bytes\n--------------|------------------------\n\"hello world\" | \"11\\r\\nhello world\\r\\n\"\n\"\"            | \"0\\r\\n\\r\\n\"\n\n## Installation\n```sh\ngo get github.com/damoye/gotalk\n```\n\n## Example\n```go\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\n\t\"github.com/damoye/gotalk\"\n)\n\nfunc handleConnection(conn net.Conn) {\n\treader := bufio.NewReader(conn)\n\tdefer conn.Close()\n\tfor {\n\t\tmessage, err := gotalk.Decode(reader)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\tbreak\n\t\t}\n\t\t_, err = conn.Write(gotalk.Encode(message))\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc main() {\n\tl, err := net.Listen(\"tcp\", fmt.Sprint(\":\", 2000))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer l.Close()\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tgo handleConnection(conn)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamoye%2Fgotalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamoye%2Fgotalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamoye%2Fgotalk/lists"}