I'm trying to access an object's property values on C#. I send my object from Node.js to C# via websockets.
I'm using this package : https://github.com/sta/websocket-sharp
Here's what I send via Node.js
var car = {
type: "Fiat",
model: "500",
color: "white"
};
Here's what I see when I log the data, this is where I'm confused. Where does 40
and 42
come from?
0{
"sid":"BWuJF1L5qN1WELSGAAAC",
"upgrades":[],
"pingInterval":25000,
"pingTimeout":60000}
40
42[{"type":"Fiat","model":"500","color":"white"}]
My C# code
using System;
using System.Linq;
using WebSocketSharp;
namespace Example
{
public class Program
{
public static void Main(string[] args)
{
using (var ws = new WebSocket("ws://localhost/socket.io/?EIO=2&transport=websocket"))
{
ws.OnMessage += (sender, e) =>
Console.WriteLine(e.Data);
ws.Connect();
Console.ReadKey(true);
}
}
}
}
When I try to access it via e.Data.First(), I see the output below. I want to access car
and its property values.
Why does it not work?
0
4