{"id":37157067,"url":"https://github.com/exapsy/graphqlws","last_synced_at":"2026-01-14T18:41:25.005Z","repository":{"id":57560155,"uuid":"325766689","full_name":"exapsy/graphqlws","owner":"exapsy","description":"Implementation of the GraphQL over WebSocket protocol in Go.","archived":false,"fork":true,"pushed_at":"2021-02-27T14:52:19.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-06T02:45:47.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/functionalfoundry/graphqlws","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"functionalfoundry/graphqlws","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exapsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-31T09:40:17.000Z","updated_at":"2021-02-27T14:52:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/exapsy/graphqlws","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/exapsy/graphqlws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exapsy%2Fgraphqlws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exapsy%2Fgraphqlws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exapsy%2Fgraphqlws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exapsy%2Fgraphqlws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exapsy","download_url":"https://codeload.github.com/exapsy/graphqlws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exapsy%2Fgraphqlws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2026-01-14T18:41:24.268Z","updated_at":"2026-01-14T18:41:24.992Z","avatar_url":"https://github.com/exapsy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Note: We're looking for a new maintainer for `graphqlws`. Please reach out via jannis@thegraph.com if you're interested.**\n\n---\n\n# graphqlws\n\nImplementation of the [GraphQL over WebSocket protocol] in Go.\nBrought to you by [Functional Foundry](https://functionalfoundry.com).\n\n[API Documentation](https://godoc.org/github.com/functionalfoundry/graphqlws)\n\n[![Build Status](https://travis-ci.org/functionalfoundry/graphqlws.svg?branch=master)](https://travis-ci.org/functionalfoundry/graphqlws)\n[![Go Report](https://goreportcard.com/badge/github.com/functionalfoundry/graphqlws)](https://goreportcard.com/report/github.com/functionalfoundry/graphqlws)\n\n## Getting started\n\n1. Install dependencies:\n   ```sh\n   go get github.com/sirupsen/logrus\n   go get github.com/x-cray/logrus-prefixed-formatter\n   go get github.com/google/uuid\n   go get github.com/gorilla/websocket\n   go get github.com/graphql-go/graphql\n   ```\n2. Clone the repository:\n   ```sh\n   mkdir -p \"$GOPATH/src/github.com/functionalfoundry\"\n   cd \"$GOPATH/src/github.com/functionalfoundry\"\n   git clone https://github.com/functionalfoundry/graphqlws\n   ```\n4. Run the tests:\n   ```sh\n   cd graphqlws\n   go test\n   ```\n3. Run the example server:\n   ```sh\n   go run graphqlws/examples/server\n   ```\n\n## Usage\n\n### Setup\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/functionalfoundry/graphqlws\"\n\t\"github.com/graphql-go/graphql\"\n)\n\nfunc main() {\n\t// Create a GraphQL schema\n\tschema, err := graphql.NewSchema(...)\n\n\t// Create a subscription manager\n\tsubscriptionManager := graphqlws.NewSubscriptionManager(\u0026schema)\n\n\t// Create a WebSocket/HTTP handler\n\tgraphqlwsHandler := graphqlws.NewHandler(graphqlws.HandlerConfig{\n\t\t// Wire up the GraphqL WebSocket handler with the subscription manager\n\t\tSubscriptionManager: subscriptionManager,\n\n\t\t// Optional: Add a hook to resolve auth tokens into users that are\n\t\t// then stored on the GraphQL WS connections\n\t\tAuthenticate: func(authToken string) (interface{}, error) {\n\t\t\t// This is just a dumb example\n\t\t\treturn \"Joe\", nil\n\t\t},\n\t})\n\n\t// The handler integrates seamlessly with existing HTTP servers\n\thttp.Handle(\"/subscriptions\", graphqlwsHandler)\n\thttp.ListenAndServe(\":8080\", nil)\n}\n```\n\n### Working with subscriptions\n\n```go\n// This assumes you have access to the above subscription manager\nsubscriptions := subscriptionManager.Subscriptions()\n\nfor conn, _ := range subscriptions {\n\t// Things you have access to here:\n\tconn.ID()   // The connection ID\n\tconn.User() // The user returned from the Authenticate function\n\n\tfor _, subscription := range subscriptions[conn] {\n\t\t// Things you have access to here:\n\t\tsubscription.ID            // The subscription ID (unique per conn)\n\t\tsubscription.OperationName // The name of the operation\n\t\tsubscription.Query         // The subscription query/queries string\n\t\tsubscription.Variables     // The subscription variables\n\t\tsubscription.Document      // The GraphQL AST for the subscription\n\t\tsubscription.Fields        // The names of top-level queries\n\t\tsubscription.Connection    // The GraphQL WS connection\n\n\t\t// Prepare an execution context for running the query\n\t\tctx := context.Context()\n\n\t\t// Re-execute the subscription query\n\t\tparams := graphql.Params{\n\t\t\tSchema:         schema, // The GraphQL schema\n\t\t\tRequestString:  subscription.Query,\n\t\t\tVariableValues: subscription.Variables,\n\t\t\tOperationName:  subscription.OperationName,\n\t\t\tContext:        ctx,\n\t\t}\n\t\tresult := graphql.Do(params)\n\n\t\t// Send query results back to the subscriber at any point\n\t\tdata := graphqlws.DataMessagePayload{\n\t\t\t// Data can be anything (interface{})\n\t\t\tData:   result.Data,\n\t\t\t// Errors is optional ([]error)\n\t\t\tErrors: graphqlws.ErrorsFromGraphQLErrors(result.Errors),\n\t\t}\n\t\tsubscription.SendData(\u0026data)\n\t}\n}\n```\n\n### Logging\n\n`graphqlws` uses [logrus](https://github.com/sirupsen/logrus) for logging.\nIn the future we might remove those logs entirely to leave logging entirely to developers\nusing `graphqlws`. Given the current solution, you can control the logging level of\n`graphqlws` by setting it through `logrus`:\n\n```go\nimport (\n  log \"github.com/sirupsen/logrus\"\n)\n\n...\n\nlog.SetLevel(log.WarnLevel)\n```\n\n## License\n\nCopyright © 2017-2019 Functional Foundry, LLC.\n\nLicensed under the [MIT License](LICENSE.md).\n\n[graphql over websocket protocol]: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexapsy%2Fgraphqlws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexapsy%2Fgraphqlws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexapsy%2Fgraphqlws/lists"}