async void mConnection_OnConnected(WebRTCConnection sender) { mConnected = true; await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed if (dc != null) { // YUP mData = dc; mData.OnStringReceiveData += mData_OnStringReceiveData; mData.OnClosing += mData_OnClosing; } await this.ContextSwitchToMessagePumpAsync(); // Switch to UI thread so we can modify the UI... (The last await may have switched us to the WebRTC thread) messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (dc != null ? "ACKed" : "NOT ACKed") + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); if (dc != null) { inputTextBox.Enabled = true; // Only setting if true, because there could already be a dataChannel that has already enabled the textbox } }
private async void DebugForm_Load(object sender, EventArgs e) { mDataChannel = await mConnection.CreateDataChannel("DebugChannel"); //mConnection._Debug_SetLossPercentage(5); await this.ContextSwitchToMessagePumpAsync(); if (mDataChannel == null) { Text = "WebRTC Debug View - Error"; return; } Text = "WebRTC Debug View - Connected"; //mConnection.DebugEvents_OnReceiverCredits += mConnection_DebugEvents_OnReceiverCredits; mConnection.DebugEvents_OnSendFastRetry += mConnection_DebugEvents_OnSendFastRetry; mConnection.DebugEvents_OnSendRetry += mConnection_DebugEvents_OnSendRetry; mConnection.DebugEvents_OnHold += mConnection_DebugEvents_OnHold; mConnection.OnConnectionSendOk += mConnection_OnConnectionSendOk; mConnection.DebugEvents_OnCongestionWindowSizeChanged += mConnection_DebugEvents_OnCongestionWindowSizeChanged; mConnection.DebugEvents_OnFastRecovery += mConnection_DebugEvents_OnFastRecovery; //mConnection.DebugEvents_OnRTTCalculated += mConnection_DebugEvents_OnRTTCalculated; mConnection.DebugEvents_OnT3RTX += mConnection_DebugEvents_OnT3RTX; //mConnection.DebugEvents_OnTSNFloorNotRaised += mConnection_DebugEvents_OnTSNFloorNotRaised; //mConnection.DebugEvents_OnSACKReceived += mConnection_DebugEvents_OnSACKReceived; StartSendingJunk(); }
async void mData_OnStringReceiveData(WebRTCDataChannel sender, string data) { await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Remote [" + sender.ChannelName + "]: " + data + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); }
async void mData_OnClosing(WebRTCDataChannel sender) { await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Data Channel (" + sender.ChannelName + ") was closed\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); }
private async void DebugForm_Load(object sender, EventArgs e) { mDataChannel = await mConnection.CreateDataChannel("DebugChannel"); //mConnection._Debug_SetLossPercentage(5); await this.ContextSwitchToMessagePumpAsync(); if (mDataChannel == null) { Text = "WebRTC Debug View - Error"; return; } Text = "WebRTC Debug View - Connected"; //mConnection.DebugEvents_OnReceiverCredits += mConnection_DebugEvents_OnReceiverCredits; mConnection.DebugEvents_OnSendFastRetry += mConnection_DebugEvents_OnSendFastRetry; mConnection.DebugEvents_OnSendRetry += mConnection_DebugEvents_OnSendRetry; mConnection.DebugEvents_OnHold += mConnection_DebugEvents_OnHold; mConnection.OnConnectionSendOk += mConnection_OnConnectionSendOk; mConnection.DebugEvents_OnCongestionWindowSizeChanged += mConnection_DebugEvents_OnCongestionWindowSizeChanged; mConnection.DebugEvents_OnFastRecovery += mConnection_DebugEvents_OnFastRecovery; //mConnection.DebugEvents_OnRTTCalculated += mConnection_DebugEvents_OnRTTCalculated; mConnection.DebugEvents_OnT3RTX += mConnection_DebugEvents_OnT3RTX; //mConnection.DebugEvents_OnTSNFloorNotRaised += mConnection_DebugEvents_OnTSNFloorNotRaised; //mConnection.DebugEvents_OnSACKReceived += mConnection_DebugEvents_OnSACKReceived; StartSendingJunk(); }
async void mConnection_OnConnected(WebRTCConnection sender) { mConnected = true; BeginInvoke((Action)(() => { messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); })); WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed if (dc != null) { // YUP mData = dc; mData.OnStringReceiveData += mData_OnStringReceiveData; mData.OnClosing += mData_OnClosing; } BeginInvoke(((Action <WebRTCDataChannel>)((d) => { messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (d != null ? "ACKed" : "NOT ACKed") + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); if (d != null) { inputTextBox.Enabled = true; // Only setting if true, because there could already be a dataChannel that has already enabled the textbox } })), dc); }
void mData_OnStringReceiveData(WebRTCDataChannel sender, string data) { BeginInvoke(((Action <WebRTCDataChannel, string>)((dc, msg) => { messageTextBox.Text += ("Remote [" + dc.ChannelName + "]: " + msg + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); })), sender, data); }
async void mConnection_OnDataChannel(WebRTCConnection sender, WebRTCDataChannel DataChannel) { mData = DataChannel; mData.OnStringReceiveData += mData_OnStringReceiveData; await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("DataChannel Created by Remote peer: (" + DataChannel.ChannelName + ") was established\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); inputTextBox.Enabled = true; }
void mConnection_OnDataChannel(WebRTCConnection sender, WebRTCDataChannel DataChannel) { mData = DataChannel; mData.OnStringReceiveData += mData_OnStringReceiveData; BeginInvoke(((Action <WebRTCDataChannel>)((dc) => { messageTextBox.Text += ("DataChannel Created by Remote peer: (" + dc.ChannelName + "[" + dc.StreamId.ToString() + "]) was established\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); inputTextBox.Enabled = true; })), DataChannel); }
void mData_OnClosing(WebRTCDataChannel sender) { try { BeginInvoke(((Action <WebRTCDataChannel>)((d) => { messageTextBox.Text += ("Data Channel (" + d.ChannelName + ") was closed\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); })), sender); } catch (InvalidOperationException) { } }
async void mConnection_OnConnected(WebRTCConnection sender) { mConnected = true; await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed if (dc != null) { // YUP mData = dc; mData.OnStringReceiveData += mData_OnStringReceiveData; mData.OnClosing += mData_OnClosing; } await this.ContextSwitchToMessagePumpAsync(); // Switch to UI thread so we can modify the UI... (The last await may have switched us to the WebRTC thread) messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (dc!=null ? "ACKed" : "NOT ACKed") + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); if (dc!=null) { inputTextBox.Enabled = true; // Only setting if true, because there could already be a dataChannel that has already enabled the textbox } }
async void mData_OnStringReceiveData(WebRTCDataChannel sender, string data) { await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Remote [" + sender.ChannelName + "]: " + data + "\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); }
async void mConnection_OnDataChannel(WebRTCConnection sender, WebRTCDataChannel DataChannel) { mData = DataChannel; mData.OnStringReceiveData += mData_OnStringReceiveData; await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("DataChannel Created by Remote peer: (" + DataChannel.ChannelName + ") was established\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); inputTextBox.Enabled = true; }
async void mData_OnClosing(WebRTCDataChannel sender) { await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI messageTextBox.Text += ("Data Channel (" + sender.ChannelName + ") was closed\r\n"); messageTextBox.Select(messageTextBox.Text.Length, 0); }