简体   繁体   中英

How to create a socket connection in Tizen C# (Weareble)

I connected the WebSocketSharp library. On the server, I see that a new client is connecting, then an error pops up in VisualStudio, and on the server in the logs I see that the client has disconnected Also in the application logs I see the message "Socket: open"

Tizen.NET 6.0.0.14995
Tizen.Wearable.CircularUI 1.4.0
WebSocketSharp-netstandard 1.0.1
Xamarin.Forms 4.3.0.908675
ws = new WebSocket("wss://server.com/socket.io/?EIO=3&transport=websocket");
ws.WaitTime = TimeSpan.FromSeconds(3);
ws.OnOpen += (sender, e) => {
   Tizen.Log.Debug(LOG_TAG, "Socket: open");
};
ws.Connect();

Error popups:

System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.Action`1.BeginInvoke(T obj, AsyncCallback callback, Object object)
   at WebSocketSharp.WebSocket.open()
   at WebSocketSharp.WebSocket.Connect()
   at testapp.App.StartTracking()
   at testapp.App.SetStatus(Boolean status)
   at testapp.UI.OnClick(Object sender, EventArgs args)
   at Xamarin.Forms.TapGestureRecognizer.SendTapped(View sender)
   at Xamarin.Forms.Platform.Tizen.TapGestureHandler.OnCompleted(View sender, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureHandler.Xamarin.Forms.Platform.Tizen.IGestureController.SendCompleted(View sender, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureDetector.OnGestureCompleted(GestureType type, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureDetector.<>c__DisplayClass25_0.<AddTapGesture>b__1(TapData data)
   at ElmSharp.GestureLayer.<>c__DisplayClass61_0`1.<SetCallback>b__0(Object info)
   at ElmSharp.GestureLayer.GestureCallbackHandler(IntPtr data, IntPtr event_info)
   at Tizen.Applications.CoreBackend.UICoreBackend.Run(String[] args)
   at Tizen.Applications.CoreApplication.Run(String[] args)
   at Tizen.Applications.CoreUIApplication.Run(String[] args)
   at testapp.Program.Main(String[] args) occurred

I managed to implement a socket connection using another library - https://archive.codeplex.com/?p=websocket4net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM