Skip to content

Commit 49cc478

Browse files
juanluelguerremattqs
authored andcommitted
Bug Fixed. Now you can use correctly Emit, passing params. (#150)
var socket = IO.Socket("http://localhost:3000"); socket.On("connect", () => { _log.Write($"Connected !"); var login = new { name = "juanlu", password = "123456" }; socket.Emit("login", login); });
1 parent dc3ceb1 commit 49cc478

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

Src/SocketIoClientDotNet.Tests.netstandard1.3/SocketIoClientDotNet.Tests.netstandard1.3.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@
3232
<ProjectReference Include="..\SocketIoClientDotNet.netstandard1.3\SocketIoClientDotNet.netstandard1.3.csproj" />
3333
</ItemGroup>
3434

35+
<ItemGroup>
36+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
37+
</ItemGroup>
38+
3539
</Project>

Src/SocketIoClientDotNet.net45/Parser/Packet.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,15 @@ public List<object> GetDataAsList()
5858
var args = new List<object>();
5959
foreach (var o in jarray)
6060
{
61-
if (o is JValue)
61+
if (o is JValue jval)
6262
{
63-
var jval = (JValue)o;
6463
if (jval != null)
6564
{
6665
args.Add(jval.Value);
6766
}
6867
}
69-
else if (o is JToken)
68+
else if (o is JToken jtoken)
7069
{
71-
var jtoken = (JToken)o;
7270
if (jtoken != null)
7371
{
7472
args.Add(jtoken);
@@ -85,8 +83,15 @@ public static JArray Args2JArray(IEnumerable<object> _args)
8583
var jsonArgs = new JArray();
8684
foreach (var o in _args)
8785
{
88-
jsonArgs.Add(o);
86+
if (!(o is string))
87+
{
88+
var obj = JObject.FromObject(o);
89+
jsonArgs.Add(obj);
90+
}
91+
else
92+
jsonArgs.Add(o);
8993
}
94+
9095
return jsonArgs;
9196
}
9297

@@ -103,7 +108,5 @@ public static JArray Remove(JArray a, int pos)
103108
}
104109
return na;
105110
}
106-
107-
108111
}
109112
}

Src/SocketIoClientDotNet.net45/Parser/Parser.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Collections.Generic;
77
using System.Text;
88

9-
109
namespace Quobject.SocketIoClientDotNet.Parser
1110
{
1211
public class Parser

Src/SocketIoClientDotNet.netstandard1.3/SocketIoClientDotNet.netstandard1.3.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
<AssemblyName>SocketIoClientDotNet</AssemblyName>
77
<AssemblyVersion>1.0.5.0</AssemblyVersion>
88
<FileVersion>1.0.5.0</FileVersion>
9-
<Version>1.0.5</Version>
10-
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
9+
<Version>1.0.7</Version>
10+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
11+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1112
</PropertyGroup>
1213

1314
<ItemGroup>

0 commit comments

Comments
 (0)