Skip to content

Commit be08ec1

Browse files
committed
Merge Query and QueryString option properities
https://github.com/Quobject/SocketIoClientDotNet/issues/16
1 parent 6cc75c7 commit be08ec1

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Src/EngineIoClientDotNet.Tests.mono/ClientTests/ServerConnectionTest.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ public void OpenAndClose()
2626

2727
var events = new ConcurrentQueue<string>();
2828

29-
var socket = new Socket(CreateOptions());
29+
var options = CreateOptions();
30+
options.Query = new Dictionary<string, string>
31+
{
32+
{
33+
"access_token", "akaka"
34+
}
35+
};
36+
options.QueryString = "akka=ekek";
37+
var socket = new Socket(options);
3038
socket.On(Socket.EVENT_OPEN, () =>
3139
{
3240
log.Info("EVENT_OPEN");

Src/EngineIoClientDotNet.mono/Client/Socket.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ public Socket(Options options)
141141
Hostname = options.Hostname;
142142
Port = options.Port;
143143
Query = options.QueryString != null ? ParseQS.Decode(options.QueryString) : new Dictionary<string, string>();
144+
145+
if (options.Query != null)
146+
{
147+
foreach (var item in options.Query)
148+
{
149+
Query.Add(item.Key,item.Value);
150+
}
151+
}
152+
153+
144154
Upgrade = options.Upgrade;
145155
Path = (options.Path ?? "/engine.io").Replace("/$", "") + "/";
146156
TimestampParam = (options.TimestampParam ?? "t");

0 commit comments

Comments
 (0)