Xamarin ve WebSocket4Net ile devam eden basit bir test yapmaya çalışıyorum, ancak "Çalışmakta olan işlem" ile Open() üzerinde başarısız oluyor. Aşağıdaki örnek kod:WebSocket4Net basit bir örnek, "Çalışmakta olan işlem" ile başarısız oluyor
using Xamarin.Forms;
using WebSocket4Net;
using System;
using SuperSocket.ClientEngine;
namespace SocketTest
{
public partial class SocketTest : ContentPage
{
private WebSocket websocket;
public SocketTest()
{
InitializeComponent();
}
void Handle_Clicked(object sender, System.EventArgs e)
{
websocket = new WebSocket("ws://echo.websocket.org/");
websocket.Opened += Websocket_Opened;
websocket.Error += Websocket_Error;
websocket.Closed += Websocket_Closed;
websocket.MessageReceived += Websocket_MessageReceived;
websocket.Open();
}
private void Websocket_Error(object sender, ErrorEventArgs e)
{
Console.WriteLine(e.Exception.Message);
}
private void Websocket_MessageReceived(object sender, EventArgs e)
{
Console.WriteLine(e.ToString());
}
private void Websocket_Closed(object sender, EventArgs e)
{
Console.WriteLine(e.ToString());
}
private void Websocket_Opened(object sender, EventArgs e)
{
websocket.Send("Hello World!");
}
}
}
Ben standart çoklu platform projesi (PCL) ile başlayan ve bağlantıyı başlatmak için bir düğme eklendi. .NET Standart Platformu = netstandard1.4
Ben .NET/Xamarin için oldukça yeni ama arkamda yazılım geliştirme uzun yıllar var:
Versions:
0.15.0 WebSocket4Net
0.8.0.13 SuperSocket
PCL
ile yapılandırılmıştır.
bu bağlantıyı soruya cevap olsa da, burada cevabın temel kısımlarını kapsar ve başvuru için bağlantıyı sağlamak için daha iyidir:
Getting this error when trying to connect in StartReceive()
İşte bir alıntı. Bağlantılı sayfa değiştiğinde yalnızca bağlantı yanıtları geçersiz olabilir. - [Yorum Yaz] (/ review/düşük kaliteli yazılar/18199825) –
@AnuragDaolagajao Bu bir bağlantı sadece bir cevap değildir. 0.14'e düşürmeyi öneriyorum. Denetimin yerine getirilmesi için daha fazla bilgi kopyalayacağım. – wonea