Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Error protocol not supported #87

Open
thevzurd opened this issue Dec 3, 2019 · 1 comment
Open

Error protocol not supported #87

thevzurd opened this issue Dec 3, 2019 · 1 comment

Comments

@thevzurd
Copy link

thevzurd commented Dec 3, 2019

I was trying out the examples and it panics at the following line with the error protocol not supported.
stream, err := node.NewStream(ctx, peer.ID, protocol.ID("/plaintext/2.0.0"))

I tried the one mentioned in the example "/chat/1.0.0" as well. Where do I define this ?

@joelcho
Copy link

joelcho commented Aug 31, 2020

The host sets the handler for a protocol, and then can new a stream to this host

main.go#L104

h.SetStreamHandler("/echo/1.0.0", func(s network.Stream) {
	if err := doEcho(s); err != nil {
		log.Println(err)
		_ = s.Reset()
	} else {
		_ = s.Close()
	}
})

main.go#L150

basicHost.NewStream(context.Background(), peerid, "/echo/1.0.0")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants