{"id":13693467,"url":"https://github.com/kataras/neffos","last_synced_at":"2025-05-16T02:09:29.868Z","repository":{"id":57484787,"uuid":"171583920","full_name":"kataras/neffos","owner":"kataras","description":"A modern, fast and scalable websocket framework with elegant API written in Go","archived":false,"fork":false,"pushed_at":"2024-04-08T17:28:16.000Z","size":1225,"stargazers_count":563,"open_issues_count":29,"forks_count":48,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-05-02T05:25:41.617Z","etag":null,"topics":["go","golang","iris","neffos","websocket"],"latest_commit_sha":null,"homepage":"http://bit.ly/neffos-wiki","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/kataras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"kataras"}},"created_at":"2019-02-20T02:10:34.000Z","updated_at":"2024-05-30T04:33:42.525Z","dependencies_parsed_at":"2023-01-30T20:16:20.937Z","dependency_job_id":"bfe153f1-71e8-4941-894a-e48928870378","html_url":"https://github.com/kataras/neffos","commit_stats":{"total_commits":210,"total_committers":4,"mean_commits":52.5,"dds":"0.10952380952380958","last_synced_commit":"1db32f4ef9ed56600049ff351c1810eedc083c81"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fneffos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fneffos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fneffos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fneffos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kataras","download_url":"https://codeload.github.com/kataras/neffos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838446,"owners_count":21004580,"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","golang","iris","neffos","websocket"],"created_at":"2024-08-02T17:01:10.712Z","updated_at":"2025-04-08T12:12:18.717Z","avatar_url":"https://github.com/kataras.png","language":"Go","readme":"\u003cimg src=\"gh_logo.png\" /\u003e\n\n[![neffos chat example](https://github.com/neffos-contrib/bootstrap-chat/raw/master/screenshot.png)](https://github.com/neffos-contrib/bootstrap-chat)\n\n[![build status](https://img.shields.io/github/actions/workflow/status/kataras/neffos/ci.yml?style=for-the-badge)](https://github.com/kataras/neffos/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=for-the-badge)](https://goreportcard.com/report/github.com/kataras/neffos)\u003c!--[![godocs](https://img.shields.io/badge/go-%20docs-488AC7.svg?style=for-the-badge)](https://godoc.org/github.com/kataras/neffos)--\u003e [![view examples](https://img.shields.io/badge/learn%20by-examples-0077b3.svg?style=for-the-badge)](https://github.com/kataras/neffos/tree/master/_examples) [![chat](https://img.shields.io/gitter/room/neffos-framework/community.svg?color=blue\u0026logo=gitter\u0026style=for-the-badge)](https://gitter.im/neffos-framework/community) [![frontend pkg](https://img.shields.io/badge/JS%20-client-BDB76B.svg?style=for-the-badge)](https://github.com/kataras/neffos.js)\n\n## About neffos\n\nNeffos is a cross-platform real-time framework with expressive, elegant API written in [Go](https://go.dev). Neffos takes the pain out of development by easing common tasks used in real-time backend and frontend applications such as:\n\n- Scale-out using redis or nats[*](_examples/scale-out)\n- Adaptive request upgradation and server dialing\n- Acknowledgements\n- Namespaces\n- Rooms\n- Broadcast\n- Event-Driven architecture\n- Request-Response architecture\n- Error Awareness\n- Asynchronous Broadcast\n- Timeouts\n- Encoding\n- Reconnection\n- Modern neffos API client for Browsers, Nodejs[*](https://github.com/kataras/neffos.js) and Go\n\n## Learning neffos\n\n\u003cdetails\u003e\n\u003csummary\u003eQuick View\u003c/summary\u003e\n\n## Server\n\n```go\nimport (\n    // [...]\n    \"github.com/kataras/neffos\"\n    \"github.com/kataras/neffos/gorilla\"\n)\n\nfunc runServer() {\n    events := make(neffos.Namespaces)\n    events.On(\"/v1\", \"workday\", func(ns *neffos.NSConn, msg neffos.Message) error {\n        date := string(msg.Body)\n\n        t, err := time.Parse(\"01-02-2006\", date)\n        if err != nil {\n            if n := ns.Conn.Increment(\"tries\"); n \u003e= 3 \u0026\u0026 n%3 == 0 {\n                // Return custom error text to the client.\n                return fmt.Errorf(\"Why not try this one? 06-24-2019\")\n            } else if n \u003e= 6 \u0026\u0026 n%2 == 0 {\n                // Fire the \"notify\" client event.\n                ns.Emit(\"notify\", []byte(\"What are you doing?\"))\n            }\n            // Return the parse error back to the client.\n            return err\n        }\n\n        weekday := t.Weekday()\n\n        if weekday == time.Saturday || weekday == time.Sunday {\n            return neffos.Reply([]byte(\"day off\"))\n        }\n\n        // Reply back to the client.\n        responseText := fmt.Sprintf(\"it's %s, do your job.\", weekday)\n        return neffos.Reply([]byte(responseText))\n    })\n\n    websocketServer := neffos.New(gorilla.DefaultUpgrader, events)\n\n    // Fire the \"/v1:notify\" event to all clients after server's 1 minute.\n    time.AfterFunc(1*time.Minute, func() {\n        websocketServer.Broadcast(nil, neffos.Message{\n            Namespace: \"/v1\",\n            Event:     \"notify\",\n            Body:      []byte(\"server is up and running for 1 minute\"),\n        })\n    })\n\n    router := http.NewServeMux()\n    router.Handle(\"/\", websocketServer)\n\n    log.Println(\"Serving websockets on localhost:8080\")\n    log.Fatal(http.ListenAndServe(\":8080\", router))\n}\n```\n\n## Go Client\n\n```go\nfunc runClient() {\n    ctx := context.TODO()\n    events := make(neffos.Namespaces)\n    events.On(\"/v1\", \"notify\", func(c *neffos.NSConn, msg neffos.Message) error {\n        log.Printf(\"Server says: %s\\n\", string(msg.Body))\n        return nil\n    })\n\n    // Connect to the server.\n    client, err := neffos.Dial(ctx,\n        gorilla.DefaultDialer,\n        \"ws://localhost:8080\",\n        events)\n    if err != nil {\n        panic(err)\n    }\n\n    // Connect to a namespace.\n    c, err := client.Connect(ctx, \"/v1\")\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(\"Please specify a date of format: mm-dd-yyyy\")\n\n    for {\n        fmt.Print(\"\u003e\u003e \")\n        var date string\n        fmt.Scanf(\"%s\", \u0026date)\n\n        // Send to the server and wait reply to this message.\n        response, err := c.Ask(ctx, \"workday\", []byte(date))\n        if err != nil {\n            if neffos.IsCloseError(err) {\n                // Check if the error is a close signal,\n                // or make use of the `\u003c- client.NotifyClose`\n                // read-only channel instead.\n                break\n            }\n\n            // \u003e\u003e 13-29-2019\n            // error received: parsing time \"13-29-2019\": month out of range\n            fmt.Printf(\"error received: %v\\n\", err)\n            continue\n        }\n\n        // \u003e\u003e 06-29-2019\n        // it's a day off!\n        //\n        // \u003e\u003e 06-24-2019\n        // it's Monday, do your job.\n        fmt.Println(string(response.Body))\n    }\n}\n```\n\n## Javascript Client\n\nNavigate to: \u003chttps://github.com/kataras/neffos.js\u003e\n\n\u003c/details\u003e\n\nNeffos contains extensive and thorough **[wiki](https://github.com/kataras/neffos/wiki)** making it easy to get started with the framework.\n\nFor a more detailed technical documentation you can head over to our [godocs](https://godoc.org/github.com/kataras/neffos). And for executable code you can always visit the [_examples](_examples/) repository's subdirectory.\n\n### Do you like to read while traveling?\n\nYou can [download](https://www.iris-go.com/neffos-book.pdf) a PDF version of the **E-Book** today and be participated in the development of neffos.\n\n[![https://iris-go.com/images/neffos-book-overview.png](https://iris-go.com/images/neffos-book-overview.png)](https://www.iris-go.com/neffos-book.pdf)\n\n## Contributing\n\nWe'd love to see your contribution to the neffos real-time framework! For more information about contributing to the neffos project please check the [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n- [neffos-contrib](https://github.com/neffos-contrib) github organisation for more programming languages support, please invite yourself.\n\n## Security Vulnerabilities\n\nIf you discover a security vulnerability within neffos, please send an e-mail to [neffos-go@outlook.com](mailto:neffos-go@outlook.com). All security vulnerabilities will be promptly addressed.\n\n## License\n\nThe word \"neffos\" has a greek origin and it is translated to \"cloud\" in English dictionary.\n\nThis project is licensed under the [MIT license](https://opensource.org/licenses/MIT).\n\u003c!-- [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkataras%2Fneffos.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Fneffos?ref=badge_large) --\u003e\n","funding_links":["https://github.com/sponsors/kataras"],"categories":["开源类库","Open source library","Go","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo"],"sub_categories":["WebSocket"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fneffos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkataras%2Fneffos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fneffos/lists"}