public void OnDataChannel(DataChannel dc)
 {
     outerInstance.RunOnUiThread(() =>
         {
             throw new Exception("AppRTC doesn't use data channels, but got: " + dc.Label() + " anyway!");
         });
 }
示例#2
0
		/// <summary>
		/// Initialize the specified dataChannel.
		/// </summary>
		/// <param name="dataChannel">Data channel.</param>
		public void Initialize (DataChannel dataChannel)
		{
			Channel = dataChannel;
			DataConnectionObserver dataConnectionObserver = new DataConnectionObserver (dataChannel, this);
			dataChannel.RegisterObserver (dataConnectionObserver);
		}
示例#3
0
		public DataConnectionObserver (DataChannel dataChannel, DataConnection dataConnection)
		{
			this.dataChannel = dataChannel;
			this.dataConnection = dataConnection;
		}
示例#4
0
		/// <summary>
		/// Raises the message event.
		/// </summary>
		/// <param name="p0">P0.</param>
		public void OnMessage (DataChannel.Buffer p0)
		{
			Log.WriteLine (LogPriority.Debug, "DataConnectionObserver", "Message Received" + p0.Data);
			dataConnection.OnMessage (p0);
		}
示例#5
0
		/// <summary>
		/// Called when the data Channel recieved an event, 
		/// </summary>
		/// <param name="p0">The Data in DataChannel.buffer format, which is is actually a Java ByteBuffer</param>
		public void OnMessage (DataChannel.Buffer p0)
		{
			MessageArrivedEventHandler handler = MessageArrived;
			Charset charset = Charset.ForName ("UTF-8");
			CharsetDecoder decoder = charset.NewDecoder ();
			String message = "";
			try {
				message = decoder.Decode (p0.Data).ToString ();
			} catch (Exception e) {
				Console.WriteLine (e.Data);
			}
			MessageArgs messageArgs = new MessageArgs ();
			messageArgs.Message = message;
			if (handler != null) {
				handler (this, messageArgs);
			}
		}