-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataChannel example #44
Comments
It will be triggered after the two peers establish a connection |
also you could set val dataChannelConfig = DataChannel.Init()
dataChannelConfig.negotiated = true
dataChannelConfig.id = 0
dataChannel = localPeer?.createDataChannel("ch0", dataChannelConfig)
dataChannel?.registerObserver(object : DataChannel.Observer {
override fun onBufferedAmountChange(p0: Long) {}
override fun onMessage(buffer: DataChannel.Buffer?) {
if (buffer == null) return
val msg = StandardCharsets.UTF_8.decode(buffer.data)
}
override fun onStateChange() {
if (dataChannel?.state() == DataChannel.State.OPEN) {
// peers connected, channel open
}
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like
PeerConnection.createDataChannel
does not triggerPeerConnection.Observer.onDataChannel
Maybe I'm doing something wrong
So could you provide small example?
The text was updated successfully, but these errors were encountered: