socket.io-client-csharp icon indicating copy to clipboard operation
socket.io-client-csharp copied to clipboard

How can I assign json data to variables?

Open Rhemecoh opened this issue 2 years ago • 3 comments

Hello,

How can I assign json data to variables?

client.On("price_changed", response =>
{
Console.WriteLine(response);
});

image

My all code:

        public static async Task Main(string[] args)
        {
            var client = new SocketIO("wss://www.haremaltin.com:2088");

            client.On("price_changed", (Data) => // Argument can be used without type.
            {

            });

            client.On("price_changed", response =>
            {

                Console.WriteLine(response);

            });

            client.OnConnected += async (sender, e) =>
            {
                // Emit a string
                await client.EmitAsync("");
                Console.WriteLine("Connected");
                Console.ReadKey();

                // Emit a string and an object
            };
            await client.ConnectAsync();
            Console.ReadKey();
        }

What I want to do is to assign the USDTRY price, the GOLD price, the EURTRY price to the variables and print them one after the other. Example: string USDTRY = USDTRYprice(26.1200); string EURTRY = EURTRYprice(28.59100); strring GOLD = GOLDprice(1622.370);

Console.WriteLine("USDTRY Price= "+ USDTRY) Console.WriteLine("EURTRY Price= "+ EURTRY) Console.WriteLine("GOLD Price= "+ GOLD)

Thank you for your help

Rhemecoh avatar Jul 10 '23 09:07 Rhemecoh