Open chrish2 opened 9 months ago
This doesn't work because there are 2 namespaces:
var client = new SocketIOClient.SocketIO("http://server_address:port/");
Hope this helps.
(edited because of grammar error)Thank you and this works! Are there any c# project in Github that uses SocketIOClient? I just want to learn how to use it from a well written project instead of I try hundreds times to let it work. Thank you.
This doesn't work because there are 2 namespaces:
- one with the name "SocketIO"
- and one with the name "SocketIOClient", containing a class called "SocketIO", which they are referring to in the "Quick Start" section. If you use the name "SocketIO", C# thinks you are referring to the namespace, which is not possible. You need to specify the namespace (SocketIOClient) and then the class name (SocketIO), like this:
var client = new SocketIOClient.SocketIO("http://server_address:port/");
Hope this helps. (edited because of grammar error)
I have followed the same but notning is working. Execution goes inside ConnectAsync will not come out only.
I have followed the same but notning is working. Execution goes inside ConnectAsync will not come out only.
What do you mean? What error do you get?
@chrish2 , @JerkoLannoo
Below is the code, where not able to build connection and execution will not comeout from "await _socketIO.ConnectAsync();". Connected flag is false and not able emit the message.
SocketIOOptions options = new SocketIOOptions(); options.Path = SocketPath; options.Query = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("token", Accesstoken), new KeyValuePair<string, string>("deviceId", DeviceId) }; options.Transport = SocketIOClient.Transport.TransportProtocol.WebSocket; options.Reconnection = true; options.ReconnectionDelayMax = 10; options.ReconnectionDelay = 1000; options.ConnectionTimeout = TimeSpan.FromMilliseconds(10000);
Uri uri = new Uri(SocketUri); SocketIOClient.SocketIO _socketIO = new SocketIOClient.SocketIO(uri, options); _socketIO.OnConnected += OnSocketIOConnected; _socketIO.OnReconnected += OnSocketIOReconnected; _socketIO.OnError += OnSocketIOError; await _socketIO.ConnectAsync();
Hi @chrish2 , @JerkoLannoo,
Upgraded sever to latest package and able to connect .net client. However, what ever sever emit the events .net client is not received but received in react client.
Any inputs on this?
I am kinda new to the C# and .NET. I installed this package in the Nuget, and I copy and paste the example code from the Readme.
I import the SocketIO and SocketIOClient in my program. However, It DOES NOT work. Could you provide a very simple example c# code that I can directly run without too many changes?
Am I correct to install this package from Nuget ? or if there are any other ways to put this library in to a project (Since I am new to C#)? Which one should I import to my project (SocketIO or SocketIOClient)Thank you.