All Projects → pion → dcnet

pion / dcnet

Licence: other
net interfaces over DataChannels

Programming Languages

go
31211 projects - #10 most used programming language


Pion DCNet

Net interfaces around WebRTC data channels.


Warning: This package is a proof of concept. Feel free to play around, log issues or even contribute but don't rely on anything!

Package DCNet augments the net.* interfaces over a WebRTC data channels.

Usage

The idea of the package is that you implement a Signaler that negotiates data channels and get a net.Listener and net.Conn on top of them. The following pseudo-code shows how this works:

Listening side:

signaler := NewSignaler(someOptions)
listener := dcnet.NewListener(signaler)
for {
	conn, err := listener.Accept()
	check(err)
	_, err = conn.Write([]byte("Hallo"))
	check(err)
}

Dialing side:

signaler := NewSignaler(someOptions)
conn, err := dcnet.Dial(signaler)
check(err)

msg := make([]byte, 100)
_, err = conn.Read(msg)
check(err)
fmt.Println(string(msg))

Examples

Please refer to the examples directory for working examples.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].