Answer the question
In order to leave comments, you need to log in
How to connect to server via Socket.IO in C#?
There is a need to transfer this code to C #
var socket = io("socket.donationalerts.ru:3001");
socket.emit('add-user', {token: "my-token", type: "minor"});
socket.on('donation', function(msg){
console.log(msg);
});
var socket = IO.Socket("http://socket.donationalerts.ru:3001/");
socket.On(Socket.EVENT_CONNECT, () => {
socket.Emit("donation");
});
socket.On("donation", (data) =>
{
Console.WriteLine(data.ToString());
socket.Disconnect();
});
Console.ReadLine();
DoWrite data = System.Byte[]
Answer the question
In order to leave comments, you need to log in
I believe in C# just a low-level response comes - an array of bytes.
It must be converted to a string:
var str = Encoding.UTF8.GetString(data);
https://msdn.microsoft.com/en-us/library/744y86tc(...
Only you would like to know what encoding is used. I assumed UTF-8
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question