{"id":21658375,"url":"https://github.com/libp2p/go-ws-transport","last_synced_at":"2025-12-30T02:48:57.163Z","repository":{"id":11332539,"uuid":"58960825","full_name":"libp2p/go-ws-transport","owner":"libp2p","description":"a websocket implementation of a go-libp2p transport","archived":true,"fork":false,"pushed_at":"2022-05-25T18:37:16.000Z","size":332,"stargazers_count":60,"open_issues_count":3,"forks_count":18,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-11-17T12:15:21.089Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libp2p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-16T19:27:48.000Z","updated_at":"2023-11-25T16:44:08.000Z","dependencies_parsed_at":"2022-09-26T18:11:40.107Z","dependency_job_id":null,"html_url":"https://github.com/libp2p/go-ws-transport","commit_stats":null,"previous_names":["whyrusleeping/ws-transport"],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-ws-transport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-ws-transport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-ws-transport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-ws-transport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/go-ws-transport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226304645,"owners_count":17603634,"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-11-25T09:29:12.073Z","updated_at":"2025-12-16T00:24:54.759Z","avatar_url":"https://github.com/libp2p.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# DEPRECATION NOTICE\n\nThis package has moved into go-libp2p as a sub-package, github.com/libp2p/go-libp2p/p2p/transport/websocket.\n\n# go-ws-transport\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai)\n[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/)\n[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)\n[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)\n[![GoDoc](https://godoc.org/github.com/libp2p/go-ws-transport?status.svg)](https://godoc.org/github.com/libp2p/go-ws-transport)\n[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-ws-transport/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-ws-transport?branch=master)\n[![Build Status](https://travis-ci.org/libp2p/go-ws-transport.svg?branch=master)](https://travis-ci.org/libp2p/go-ws-transport)\n\n\u003e A libp2p transport implementation using WebSockets\n\n`go-ws-transport` is an implementation of the [libp2p transport\ninterface][concept-transport] that streams data over\n[WebSockets][spec-websockets], which are themselves layered over TCP/IP. It is\nincluded by default in the main [`go-libp2p`][go-libp2p] \"entry point\" module.\n\n## Table of Contents\n\n- [go-ws-transport](#go-ws-transport)\n    - [Table of Contents](#table-of-contents)\n    - [Install](#install)\n    - [Usage](#usage)\n    - [Addresses](#addresses)\n    - [Security and Multiplexing](#security-and-multiplexing)\n    - [Contribute](#contribute)\n        - [Want to hack on IPFS?](#want-to-hack-on-ipfs)\n    - [License](#license)\n\n## Install\n\n`go-ws-transport` is included as a dependency of `go-libp2p`, which is the most\ncommon libp2p entry point. If you depend on `go-libp2p`, there is generally no\nneed to explicitly depend on this module.\n\n`go-ws-transport` is a standard Go module which can be installed with:\n\n```sh\n\u003e go get github.com/libp2p/go-ws-transport\n```\n\nThis repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of\ngo 1.11 and later with modules enabled will automatically pull the latest tagged release\nby referencing this package. Upgrades to future releases can be managed using `go get`,\nor by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies).\n\n## Usage\n\nWebSockets are one of the default transports enabled when constructing a standard libp2p\nHost, along with [TCP](https://github.com/libp2p/go-tcp-transport).\n\nCalling [`libp2p.New`][godoc-libp2p-new] to construct a libp2p Host will enable\nthe WebSocket transport, unless you override the default transports by passing in\n`Options` to `libp2p.New`.\n\nTo explicitly enable the WebSocket transport while constructing a host, use the\n`libp2p.Transport` option, passing in the `ws.New` constructor function:\n\n``` go\n\nimport (\n    libp2p \"github.com/libp2p/go-libp2p\"\n    ws \"github.com/libp2p/go-ws-transport\"\n)\n\n// WebSockets only:\nh, err := libp2p.New(\n    libp2p.Transport(ws.New)\n)\n```\n\nThe example above will replace the default transports with a single WebSocket\ntransport. To add multiple tranports, use `ChainOptions`:\n\n``` go\n// WebSockets and QUIC:\nh, err := libp2p.New(\n    libp2p.ChainOptions(\n        libp2p.Transport(ws.New),\n        libp2p.Transport(quic.NewTransport)) // see https://github.com/libp2p/go-libp2p-quic-transport\n)\n```\n\n## Addresses\n\nThe WebSocket transport supports [multiaddrs][multiaddr] that contain a `ws`\ncomponent, which is encapsulated within (or layered onto) another valid TCP\nmultiaddr.\n\nExamples:\n\n| addr                          | description                                        |\n|-------------------------------|----------------------------------------------------|\n| `/ip4/1.2.3.4/tcp/1234/ws`    | IPv4: 1.2.3.4, TCP port 1234                       |\n| `/ip6/::1/tcp/1234/ws`        | IPv6 loopback, TCP port 1234                       |\n| `/dns4/example.com/tcp/80/ws` | DNS over IPv4, hostname `example.com`, TCP port 80 |\n\nNotice that the `/ws` multiaddr component contextualizes an existing TCP/IP\nmultiaddr and does not require any additional addressing information.\n\n## Security and Multiplexing\n\nWhile the WebSocket spec defines a `wss` URI scheme for encrypted WebSocket\nconnections, support for `wss` URIs relies on TLS, which wraps the WebSocket\nconnection in a similar manner to TLS-protected HTTP traffic.\n\nAs libp2p does not integrate with the TLS Certificate Authority infrastructure\nby design, security for WebSockets is provided by a [transport\nupgrader][transport-upgrader]. The transport upgrader negotiates transport\nsecurity for each connection according to the protocols supported by each party.\n\nThe transport upgrader also negotiates a stream multiplexing protocol to allow\nmany bidirectional streams to coexist on a single WebSocket connection.\n\n## Contribute\n\nFeel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-ws-transport/issues)!\n\nThis repository falls under the libp2p [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md).\n\n### Want to hack on libp2p?\n\n[![](https://cdn.rawgit.com/libp2p/community/master/img/contribute.gif)](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md)\n\n## License\n\nMIT\n\n---\n\nThe last gx published version of this module was: 2.0.27: QmaSWc4ox6SZQF6DHZvDuM9sP1syNajkKuPXmKR1t5BAz5\n\n\u003c!-- reference links --\u003e\n[go-libp2p]: https://github.com/libp2p/go-libp2p\n[concept-transport]: https://docs.libp2p.io/concepts/transport/\n[interface-host]: https://github.com/libp2p/go-libp2p-core/blob/master/host/host.go\n[godoc-libp2p-new]: https://godoc.org/github.com/libp2p/go-libp2p#New\n[transport-upgrader]: https://github.com/libp2p/go-libp2p-transport-upgrader\n[multiaddr]: https://github.com/multiformats/multiaddr\n[spec-websockets]: https://tools.ietf.org/html/rfc6455\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fgo-ws-transport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fgo-ws-transport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fgo-ws-transport/lists"}