pion / datachannel Goto Github PK
View Code? Open in Web Editor NEWA Go implementation of WebRTC Data Channels
Home Page: https://pion.ly/
License: MIT License
A Go implementation of WebRTC Data Channels
Home Page: https://pion.ly/
License: MIT License
Version: b9a54c5
$ go test -v
=== RUN TestDataChannel
=== RUN TestDataChannel/ChannelTypeReliableOrdered
=== RUN TestDataChannel/ChannelTypeReliableUnordered
goroutine profile: total 9
2 @ 0x3fbb36 0x40b232 0x4f7251 0x429961
# 0x4f7250 github.com/pion/sctp.(*Association).writeLoop+0x230 C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/association.go:559
2 @ 0x3fbb36 0x40b232 0x518865 0x4f67fe 0x429961
# 0x518864 github.com/pion/transport/test.(*bridgeConn).Read+0x124 C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/test/bridge.go:73
# 0x4f67fd github.com/pion/sctp.(*Association).readLoop+0x15d C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/association.go:510
1 @ 0x3fbb36 0x3c686c 0x3c6298 0x496ab5 0x4986ce 0x495e62 0x49857f 0x4972dd 0x56124b 0x3fb797 0x429961
# 0x496ab4 testing.(*T).Run+0x374 C:/Program Files/Go/src/testing/testing.go:1307
# 0x4986cd testing.runTests.func1+0x6d C:/Program Files/Go/src/testing/testing.go:1598
# 0x495e61 testing.tRunner+0x101 C:/Program Files/Go/src/testing/testing.go:1259
# 0x49857e testing.runTests+0x43e C:/Program Files/Go/src/testing/testing.go:1596
# 0x4972dc testing.(*M).Run+0x51c C:/Program Files/Go/src/testing/testing.go:1504
# 0x56124a main.main+0x14a _testmain.go:59
# 0x3fb796 runtime.main+0x216 C:/Program Files/Go/src/runtime/proc.go:255
1 @ 0x3fbb36 0x3c686c 0x3c6298 0x496ab5 0x55c4a5 0x495e62 0x429961
# 0x496ab4 testing.(*T).Run+0x374 C:/Program Files/Go/src/testing/testing.go:1307
# 0x55c4a4 github.com/pion/datachannel.TestDataChannel+0x164 D:/git/pion/datachannel/datachannel_test.go:347
# 0x495e61 testing.tRunner+0x101 C:/Program Files/Go/src/testing/testing.go:1259
1 @ 0x3fbb36 0x3c686c 0x3c62d8 0x558b17 0x558afe 0x55c850 0x495e62 0x429961
# 0x558b16 github.com/pion/sctp.(*Association).AcceptStream+0x36 C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/association.go:1315
# 0x558afd github.com/pion/datachannel.Accept+0x1d D:/git/pion/datachannel/datachannel.go:116
# 0x55c84f github.com/pion/datachannel.TestDataChannel.func2+0x2ef D:/git/pion/datachannel/datachannel_test.go:373
# 0x495e61 testing.tRunner+0x101 C:/Program Files/Go/src/testing/testing.go:1259
1 @ 0x3fbb36 0x40b232 0x511bb1 0x429961
# 0x511bb0 github.com/pion/sctp.(*rtxTimer).start.func1+0xd0 C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/rtx_timer.go:151
1 @ 0x423425 0x4c3875 0x4c368d 0x4c082b 0x51ac65 0x429961
# 0x423424 runtime/pprof.runtime_goroutineProfileWithLabels+0x24 C:/Program Files/Go/src/runtime/mprof.go:746
# 0x4c3874 runtime/pprof.writeRuntimeProfile+0xb4 C:/Program Files/Go/src/runtime/pprof/pprof.go:724
# 0x4c368c runtime/pprof.writeGoroutine+0x4c C:/Program Files/Go/src/runtime/pprof/pprof.go:684
# 0x4c082a runtime/pprof.(*Profile).WriteTo+0x14a C:/Program Files/Go/src/runtime/pprof/pprof.go:331
# 0x51ac64 github.com/pion/transport/test.TimeOut.func1+0x44 C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/test/util.go:21
panic: timeout
goroutine 55 [running]:
github.com/pion/transport/test.TimeOut.func1()
C:/Users/shell/go/pkg/mod/github.com/pion/[email protected]/test/util.go:24 +0xa5
created by time.goFunc
C:/Program Files/Go/src/time/sleep.go:180 +0x31
exit status 2
FAIL github.com/pion/datachannel 10.495s
Intentionally hitting the error at
Line 277 in 9710006
%s
for formatting but doesn't work for channelOpen
(I think)
A nicely formatted message.
datachannel ERROR: 2021/11/09 02:46:57 Failed to handle DCEP: invalid Message Type &{%!s(datachannel.ChannelType=0) %!s(uint16=256) %!s(uint32=0) initial_data_channel }
ReadDeadline
on B
of 2 seconds from the current timeRead
call on B
.Close
on A
100ms after step 2PR for test: #161
Read
on B
should return io.EOF
.
Read
blocks until deadline is exceeded.
Copy the style from pions/webrtc including readme, license, ... .
"unordered" parameter at SCTP should not be set to true until DATA_CHANNEL_ACK is received.
From draft-ietf-rtcweb-data-protocol-09, section 6:
However, before the DATA_CHANNEL_ACK
message or any other message has been received on a Data Channel, all
other messages containing user data and belonging to this Data
Channel MUST be sent ordered, no matter whether the Data Channel is
ordered or not.
The ACK had been ignored until we started to parse the ack by the PR #9. Now, we should implement the above correctly.
SCTP later implements the partial-reliability, but it does not know receipt of DCEP ACK. DCEP has to tell SCTP layer how to enable "unordered". (We can use SetReliabilityParams() method it sctp.Stream provides.
Relates to pions/webrtc#167
https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.7
Closing of a data channel MUST be signaled by resetting the
corresponding outgoing streams [RFC6525]. This means that if one
side decides to close the data channel, it resets the corresponding
outgoing stream. When the peer sees that an incoming stream was
reset, it also resets its corresponding outgoing stream. Once this
is completed, the data channel is closed. Resetting a stream sets
the Stream Sequence Numbers (SSNs) of the stream back to 'zero' with
a corresponding notification to the application layer that the reset
has been performed. Streams are available for reuse after a reset
has been performed.
Add methods to set deadlines for Read
/Write
from the datachannel. The underlying SCTP stream has a SetReadDeadline
method that can be exposed for setting the Read
deadline.
The datachannel Read
method seems to block until there is data or the channel is closed. To wrap a datachannel in a net.Conn
we need to wrap it with the methods to set deadlines, and have the Read
/Write
calls execute in a separate goroutine. Using the methods already available on the SCTP stream would be efficient and make datachannels easier to use.
To implement SetReadDeadline
, we run a loop that uses the current Read
call to write to a buffer, and notifies the caller of completion of the Read
via a channel. This allows us to await a timer in addition to completion of the Read
.
I use pion webrtc on the server with a browser client peer. Steps to reproduce issue:
NOTE: this only happens when establishing a connection directly using UDP STUN. This doesn't seem to happen when using a TURN server in TCP mode
Expect the datachannel connection to remain stable and messages sent to be received on the server. I used to use node-webrtc before porting the code to golang (https://github.com/node-webrtc/node-webrtc), datachannel used to be quite a bit stable there.
OnMessage
events stop firing in response to data sent by the browser, even though the datachannel remains in the "open" state on the browser. Sometimes, after much more time passes, the datachannel goes into the "closed" state. In between this time, it's in a limbo of being unusable for extended lengths of time. The peerconnection stays open throughout the entire duration.
Copy the configuration from pions/webrtc.
There is a general demand on using DataChannel in non-browser environment with WASM runtime and Javascript support, such as in nodeJS or in other standalone environments.
Can the pion dataChannel project be compiled to WASM (WebAssembly) to be used in a non-browser environment with WASM runtime?
Another question is, is the pion DataChannel project independent from the whole pion WetRTC project ? I think the compiled library of pion DataChannel project should be more lightweight.
Can anybody help on the questions ?
Right now we assume the channel is open right away. We actually shouldn't fire the Open event until we get a ChannelAck back.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
This issue provides visibility into Renovate updates and their statuses. Learn more
This repository currently has no open or pending branches.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.