Communicating with a socket.io server via c#

前端 未结 6 1221
刺人心
刺人心 2020-12-01 01:19

Is there a c# client that follows the socket.io protocol? I have a socket.io server that is communicating with a socket.io javascript client via a website, but i also need t

6条回答
  •  萌比男神i
    2020-12-01 01:46

    Well, I found another .Net library which works great with socket.io. It is the most updated too. Follow the below link,

    Quobject/SocketIoClientDotNet

    using Quobject.SocketIoClientDotNet.Client;
    
    var socket = IO.Socket("http://localhost");
    socket.On(Socket.EVENT_CONNECT, () =>
    {
        socket.Emit("hi");
    });
    
    socket.On("hi", (data) =>
    {
        Console.WriteLine(data);
        socket.Disconnect();
    });
    Console.ReadLine();
    

    Hope, it helps someone.

提交回复
热议问题