Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/libp2p/go-libp2p-webrtc-direct/examples/standalone

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/libp2p/go-libp2p-webrtc-direct/examples/standalone

  • v0.0.0-20221122205243-f6acac0a2b38
  • Source
  • Go
  • Socket score

Version published
Created
Source

standalone

This example shows the transport being used on its own. It also shows off compatibility with js-libp2p-webrtc-direct.

Go

Install dependencies

TODO: Check the root readme

Listener

go run main.go -listen

Output

[listener] Listening
[listener] Got connection
[listener] Got stream
[listener] Received:
hey, how is it going. I am the dialer
Failed to accept data channel: The association is closed

The last line is harmless warning printed by the pions/webrtc library.

Dialer

go run main.go

Output

Warning: Certificate not checked
[dialer] Opened connection
[dialer] Opened stream
Failed to push SCTP packet: Failed sending reply: dtls: conn is closed
Warning: mux: no endpoint for packet starting with 23
Failed to push SCTP packet: Failed sending reply: dtls: conn is closed
Warning: mux: no endpoint for packet starting with 21
Failed to accept data channel: The association is closed

The warnings printed by the pions/webrtc library are harmless.

Javascript

The equivalent javascript example is also provided. It can be used as follows:

Install dependencies

npm install

Listener

node index.js --listen

Output

[listener] Listening
[listener] Got connection
[listener] Got stream
[listener] Received:
hey, how is it going. I am the dialer

Dialer

node index.js

Output

[dialer] Opened connection
[dialer] Opened stream

FAQs

Package last updated on 22 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc