Open alrevuelta opened 8 months ago
I don't see why not, but this library provides is an HTTP client and maybe you need a websocket client mounted on top of go-libp2p-gostream directly (and a websocket server instead of the normal one we use).
Also, know that the current libp2p team kind-of rewrote this library, I think: https://github.com/libp2p/go-libp2p/blob/master/p2p/http/libp2phttp.go (see https://github.com/libp2p/specs/blob/d8850aa6d0581558ac94fd1fe908ff4a72e80eda/http/README.md). While it is focused on doing libp2p-streams on HTTP connections, I think it can do the opposite too (http connections over libp2p-streams, like this library). In general it is confusing to me and I might be wrong, but just so you know.
This repo allows HTTP requests via libp2p. I was wondering if it would be possible to reuse that to upgrade the connections to WebSockets, having then an open stream between the client and the libp2p host, so that both can write data to it.
In other words:
/hello
endpoint and in theHandleFunc
it upgrades the connection to websockets (eg using gorilla/websocket).("libp2p://16Uiu2HAkuYuv5y1oGQSccX5kxYnW6MDZ2QqPi5y6HjL2baUSDP9W/hello"
)i) and ii) should be pretty similar to the examples in this repo, but unsure if iii) is possible or if it even makes sense.